From e69467bbc95e699a7e140d73b3f9b58f97f79eaa Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 11 Mar 2015 06:21:17 +0000 Subject: 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 --- src/Fl_Pixmap.cxx | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'src/Fl_Pixmap.cxx') diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 2bb776b6b..8064979dd 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -135,21 +135,6 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy); } -int Fl_Quartz_Graphics_Driver::draw_scaled(Fl_Pixmap *img, int XP, int YP, int WP, int HP) { - int X, Y, W, H; - fl_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; - fl_push_no_clip(); // remove the FLTK clip that can't be rescaled - CGContextSaveGState(fl_gc); - CGContextClipToRect(fl_gc, CGRectMake(X, Y, W, H)); // this clip path will be rescaled & translated - CGContextTranslateCTM(fl_gc, XP, YP); - CGContextScaleCTM(fl_gc, float(WP)/img->w(), float(HP)/img->h()); - draw(img, 0, 0, img->w(), img->h(), 0, 0); - CGContextRestoreGState(fl_gc); - fl_pop_clip(); // restore FLTK's clip - return 1; -} - #elif defined(WIN32) void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { int X, Y, W, H; @@ -196,20 +181,6 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP } } -int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Pixmap *img, int XP, int YP, int WP, int HP) { - XFORM old_tr, tr; - GetWorldTransform(fl_gc, &old_tr); // storing old transform - tr.eM11 = float(WP)/float(img->w()); - tr.eM22 = float(HP)/float(img->h()); - tr.eM12 = tr.eM21 = 0; - tr.eDx = XP; - tr.eDy = YP; - ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY); - draw(img, 0, 0, img->w(), img->h(), 0, 0); - SetWorldTransform(fl_gc, &old_tr); -} - - #else // Xlib void Fl_Xlib_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { int X, Y, W, H; -- cgit v1.2.3