diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 01014f49b..e2a29da4c 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -40,7 +40,7 @@ private: void set_current_(); void draw_fixed(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); void draw_fixed(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); - virtual void make_unused_color_(unsigned char &r, unsigned char &g, unsigned char &b); + virtual void make_unused_color_(unsigned char &r, unsigned char &g, unsigned char &b, int color_count, void **data); protected: void draw_fixed(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP, int cx, int cy); void cache(Fl_RGB_Image *rgb); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index cf476f7c4..5bb515771 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -700,6 +700,38 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, } } +// Makes an RGB triplet different from all the colors used in the pixmap +// and computes Fl_Graphics_Driver::need_pixmap_bg_color from this triplet +void Fl_GDI_Graphics_Driver::make_unused_color_(uchar &r, uchar &g, uchar &b, int color_count, void **data) { + typedef struct { uchar r; uchar g; uchar b; } UsedColor; + UsedColor *used_colors = *(UsedColor**)data; + int i; + r = 2; g = 3; b = 4; + while (1) { + for ( i=0; i<color_count; i++ ) + if ( used_colors[i].r == r && + used_colors[i].g == g && + used_colors[i].b == b ) + break; + if (i >= color_count) { + free((void*)used_colors); + *(UsedColor**)data = NULL; + need_pixmap_bg_color = RGB(r, g, b); + return; + } + if (r < 255) { + r++; + } else { + r = 0; + if (g < 255) { + g++; + } else { + g = 0; + b++; + } + } + } +} void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { Fl_Image_Surface *surf = new Fl_Image_Surface(img->data_w(), img->data_h()); |
