From 2abe8bd413f97da1beb5c144e1a1f6cb3db25290 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 13 Apr 2018 13:22:15 +0000 Subject: Homogenise and simplify the API of Fl_Graphics_Driver::cache(image-type *) virtual member functions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12833 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Graphics_Driver.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Fl_Graphics_Driver.cxx') diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index e7b9036b9..2b331f327 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -328,12 +328,14 @@ void Fl_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int WP, int if (!*id(pxm)) { if (pxm->data_w() != w2 || pxm->data_h() != h2) { // build a scaled id_ & mask_ for pxm Fl_Pixmap *pxm2 = (Fl_Pixmap*)pxm->copy(w2, h2); - *id(pxm) = cache(pxm2); + cache(pxm2); + *id(pxm) = *id(pxm2); + *id(pxm2) = 0; *pw = w2; *ph = h2; // memorize size of cached form of pixmap *mask(pxm) = *mask(pxm2); *mask(pxm2) = 0; delete pxm2; - } else *id(pxm) = cache(pxm); + } else cache(pxm); } // draw pxm using its scaled id_ & pixmap_ draw_fixed(pxm, X, Y, W, H, cx, cy); @@ -355,10 +357,12 @@ void Fl_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP, int WP, int if (!*id(bm)) { if (bm->data_w() != w2 || bm->data_h() != h2) { // build a scaled id_ for bm Fl_Bitmap *bm2 = (Fl_Bitmap*)bm->copy(w2, h2); - *id(bm) = cache(bm2); + cache(bm2); + *id(bm) = *id(bm2); + *id(bm2) = 0; *pw = w2; *ph = h2; // memorize size of cached form of bitmap delete bm2; - } else *id(bm) = cache(bm); + } else cache(bm); } // draw bm using its scaled id_ draw_fixed(bm, X, Y, W, H, cx, cy); -- cgit v1.2.3