diff options
| author | Manolo Gouy <Manolo> | 2015-03-11 06:21:17 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-03-11 06:21:17 +0000 |
| commit | e69467bbc95e699a7e140d73b3f9b58f97f79eaa (patch) | |
| tree | 35aca3339bc4cb00824772c9998065e1dd83dbd4 /src/ps_image.cxx | |
| parent | dbde470f8d9803d6986ff57b7dfcb40d679508b7 (diff) | |
Implementation of Fl_Shared_Image::scale(width, height) for scaled image drawing - cont'd
Shorter implementation based on Fl_Graphics_Driver::draw_scaled(Fl_Image *,...).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10616 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/ps_image.cxx')
| -rw-r--r-- | src/ps_image.cxx | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/ps_image.cxx b/src/ps_image.cxx index ca71121b9..0cee215e3 100644 --- a/src/ps_image.cxx +++ b/src/ps_image.cxx @@ -602,27 +602,14 @@ void Fl_PostScript_Graphics_Driver::draw(Fl_RGB_Image * rgb,int XP, int YP, int mask=0; } -int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP){ - int X, Y, W, H; - clip_box(XP,YP,WP,HP,X,Y,W,H); // X,Y,W,H will give the unclipped area of XP,YP,WP,HP - if (W == 0 || H == 0) return 1; - push_no_clip(); // remove the FLTK clip that can't be rescaled - clocale_printf("%d %d %i %i CL\n", X, Y, W, H); - clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/rgb->w(), float(HP)/rgb->h()); - draw(rgb, 0, 0, rgb->w(), rgb->h(), 0, 0); - clocale_printf("GR GR\n"); - pop_clip(); // restore FLTK's clip - return 1; -} - -int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_Pixmap *img, int XP, int YP, int WP, int HP){ +int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP){ int X, Y, W, H; clip_box(XP,YP,WP,HP,X,Y,W,H); // X,Y,W,H will give the unclipped area of XP,YP,WP,HP if (W == 0 || H == 0) return 1; push_no_clip(); // remove the FLTK clip that can't be rescaled clocale_printf("%d %d %i %i CL\n", X, Y, W, H); clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/img->w(), float(HP)/img->h()); - draw(img, 0, 0, img->w(), img->h(), 0, 0); + img->draw(0, 0, img->w(), img->h(), 0, 0); clocale_printf("GR GR\n"); pop_clip(); // restore FLTK's clip return 1; |
