Added the possibility to call Fl_Paged_Device::scale(factor) with a single argument.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8366 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-02-04 09:17:45 +00:00
parent 2251609ab3
commit 7c932c25d6
8 changed files with 11 additions and 6 deletions

View File

@ -126,7 +126,7 @@ public:
virtual void margins(int *left, int *top, int *right, int *bottom);
virtual void origin(int x, int y);
virtual void origin(int *x, int *y);
virtual void scale(float scale_x, float scale_y);
virtual void scale(float scale_x, float scale_y = 0.);
virtual void rotate(float angle);
virtual void translate(int x, int y);
virtual void untranslate(void);

View File

@ -234,7 +234,7 @@ public:
void margins(int *left, int *top, int *right, int *bottom);
void origin(int *x, int *y);
void origin(int x, int y);
void scale (float scale_x, float scale_y);
void scale (float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);

View File

@ -85,7 +85,7 @@ public:
void margins(int *left, int *top, int *right, int *bottom);
void origin(int *x, int *y);
void origin(int x, int y);
void scale (float scale_x, float scale_y);
void scale (float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);
@ -160,7 +160,7 @@ public:
void margins(int *left, int *top, int *right, int *bottom);
void origin(int *x, int *y);
void origin(int x, int y);
void scale(float scale_x, float scale_y);
void scale(float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);

View File

@ -209,6 +209,7 @@ void Fl_System_Printer::origin (int deltax, int deltay)
void Fl_System_Printer::scale (float scalex, float scaley)
{
if (scaley == 0.) scaley = scalex;
int w, h;
SetWindowExtEx(fl_gc, (int)(720 / scalex + 0.5), (int)(720 / scaley + 0.5), NULL);
printable_rect(&w, &h);

View File

@ -207,6 +207,8 @@ void Fl_Paged_Device::origin(int x, int y) {}
Successive scale() calls don't combine their effects.
@param scale_x Horizontal dimensions of plot are multiplied by this quantity.
@param scale_y Same as above, vertically.
The value 0. is equivalent to setting \p scale_y = \p scale_x. Thus, scale(factor);
is equivalent to scale(factor, factor);
*/
void Fl_Paged_Device::scale (float scale_x, float scale_y) {}

View File

@ -1402,6 +1402,7 @@ void Fl_PostScript_File_Device::origin(int x, int y)
void Fl_PostScript_File_Device::scale (float s_x, float s_y)
{
if (s_y == 0.) s_y = s_x;
Fl_PostScript_Graphics_Driver *ps = driver();
ps->scale_x = s_x;
ps->scale_y = s_y;

View File

@ -193,6 +193,7 @@ void Fl_System_Printer::origin(int x, int y)
void Fl_System_Printer::scale (float s_x, float s_y)
{
if (s_y == 0.) s_y = s_x;
scale_x = s_x;
scale_y = s_y;
CGContextRestoreGState(fl_gc);

View File

@ -2787,7 +2787,7 @@ int Fl_X::screen_init(XRectangle screens[], float dpi[])
if (win->w()>w || win->h()>h) {
scale = (float)w/win->w();
if ((float)h/win->h() < scale) scale = (float)h/win->h();
printer.scale(scale, scale);
printer.scale(scale);
}
//#define ROTATE 1
#ifdef ROTATE