diff options
| author | Manolo Gouy <Manolo> | 2018-04-13 13:22:15 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-04-13 13:22:15 +0000 |
| commit | 2abe8bd413f97da1beb5c144e1a1f6cb3db25290 (patch) | |
| tree | 6ec8ad0471f4fde2a475a555a5823be6c592a0bc /src/drivers/GDI | |
| parent | e440b8859f84b65517e016b5b623d09f99289ab9 (diff) | |
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
Diffstat (limited to 'src/drivers/GDI')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 6 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 27 |
2 files changed, 12 insertions, 21 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index eae3b7925..f4910fc47 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -44,7 +44,7 @@ private: void draw_fixed(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); protected: void draw_fixed(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP, int cx, int cy); - fl_uintptr_t cache(Fl_RGB_Image *rgb); + void cache(Fl_RGB_Image *rgb); HDC gc_; int numcount; int counts[20]; @@ -73,9 +73,9 @@ public: virtual void draw_image_unscaled(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); virtual void draw_image_mono_unscaled(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); virtual void draw_image_mono_unscaled(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); - fl_uintptr_t cache(Fl_Pixmap *img); + void cache(Fl_Pixmap *img); virtual void uncache_pixmap(fl_uintptr_t p); - fl_uintptr_t cache(Fl_Bitmap *img); + void cache(Fl_Bitmap *img); void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_); virtual double width_unscaled(const char *str, int n); virtual double width_unscaled(unsigned int c); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index af919cf5e..fc63f727a 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -442,7 +442,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP, } if (recache || !*id(bm)) { bm->uncache(); - *Fl_Graphics_Driver::id(bm) = cache(bm); + cache(bm); } HDC tempdc; int save; @@ -478,7 +478,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP, } -fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img) +void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img) { Fl_Image_Surface *surface = new Fl_Image_Surface(img->data_w(), img->data_h()); Fl_Surface_Device::push_current(surface); @@ -498,7 +498,6 @@ fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img) *pw = img->data_w(); *ph = img->data_h(); *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)offs; - return (fl_uintptr_t)offs; } @@ -510,11 +509,7 @@ void Fl_GDI_Graphics_Driver::draw_fixed(Fl_RGB_Image *img, int X, int Y, int W, if (W + cx > img->data_w()) W = img->data_w() - cx; if (H + cy > img->data_h()) H = img->data_h() - cy; if (!*Fl_Graphics_Driver::id(img)) { - *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)cache(img); - int *pw, *ph; - cache_w_h(img, pw, ph); - *pw = img->data_w(); - *ph = img->data_h(); + cache(img); } if (*Fl_Graphics_Driver::mask(img)) { HDC new_gc = CreateCompatibleDC(gc_); @@ -542,11 +537,7 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP, return; } if (!*Fl_Graphics_Driver::id(rgb)) { - *Fl_Graphics_Driver::id(rgb) = (fl_uintptr_t)cache(rgb); - int *pw, *ph; - cache_w_h(rgb, pw, ph); - *pw = rgb->data_w(); - *ph = rgb->data_h(); + cache(rgb); } float scaleW = float(rgb->data_w())/rgb->w(); float scaleH = float(rgb->data_h())/rgb->h(); @@ -630,12 +621,12 @@ static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) { return bm; } -fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Bitmap *bm) { +void Fl_GDI_Graphics_Driver::cache(Fl_Bitmap *bm) { int *pw, *ph; cache_w_h(bm, pw, ph); *pw = bm->data_w(); *ph = bm->data_h(); - return (fl_uintptr_t)fl_create_bitmap(bm->data_w(), bm->data_h(), bm->array); + *Fl_Graphics_Driver::id(bm) = (fl_uintptr_t)fl_create_bitmap(bm->data_w(), bm->data_h(), bm->array); } void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int H, int cx, int cy) { @@ -673,7 +664,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, } if (recache || !*id(pxm)) { pxm->uncache(); - *Fl_Graphics_Driver::id(pxm) = cache(pxm); + cache(pxm); } HDC new_gc = CreateCompatibleDC(gc_); int save = SaveDC(new_gc); @@ -693,7 +684,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, } -fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { +void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { Fl_Image_Surface *surf = new Fl_Image_Surface(img->data_w(), img->data_h()); Fl_Surface_Device::push_current(surf); uchar *bitmap = 0; @@ -712,7 +703,7 @@ fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { cache_w_h(img, pw, ph); *pw = img->data_w(); *ph = img->data_h(); - return (fl_uintptr_t)id; + *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)id; } void Fl_GDI_Graphics_Driver::uncache_pixmap(fl_uintptr_t offscreen) { |
