diff options
| author | Manolo Gouy <Manolo> | 2018-04-18 15:03:51 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-04-18 15:03:51 +0000 |
| commit | 15e3f4b2d2fca4e501e13a2a303880013955dfcd (patch) | |
| tree | 537ced5b9968b57fd21c8c428fc6d7a616892ac5 /src/fl_draw_pixmap.cxx | |
| parent | 231e0edff6817b196abdd69b9c7539a213582d52 (diff) | |
Simplify the implementation of printing of Fl_Pixmap images under Windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12851 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw_pixmap.cxx')
| -rw-r--r-- | src/fl_draw_pixmap.cxx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx index 6b808a1a9..735fe30c3 100644 --- a/src/fl_draw_pixmap.cxx +++ b/src/fl_draw_pixmap.cxx @@ -36,7 +36,7 @@ #include <FL/Fl.H> #include <FL/Fl_System_Driver.H> #if defined(FL_CFG_SYS_WIN32) -#include "drivers/WinAPI/Fl_WinAPI_System_Driver.H" +#include "drivers/GDI/Fl_GDI_Graphics_Driver.H" #endif #include <FL/platform.H> #include <FL/fl_draw.H> @@ -91,11 +91,10 @@ int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color bg) { #if defined(FL_CFG_SYS_WIN32) -unsigned Fl_WinAPI_System_Driver::win_pixmap_bg_color = 0; // the RGB() of the pixmap background color // Makes an RGB triplet different from all the colors used in the pixmap -// and compute win_pixmap_bg_color from this triplet -void Fl_WinAPI_System_Driver::make_unused_color(uchar &r, uchar &g, uchar &b) { +// and compute 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 i; r = 2; g = 3; b = 4; while (1) { @@ -106,7 +105,7 @@ void Fl_WinAPI_System_Driver::make_unused_color(uchar &r, uchar &g, uchar &b) { break; if (i >= color_count) { free((void*)used_colors); used_colors = NULL; - win_pixmap_bg_color = RGB(r, g, b); + need_pixmap_bg_color = RGB(r, g, b); return; } if (r < 255) { @@ -128,7 +127,6 @@ void Fl_WinAPI_System_Driver::make_unused_color(uchar &r, uchar &g, uchar &b) { int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { int w, h; const uchar*const* data = (const uchar*const*)(cdata+1); - static int use_extra_transparent_processing = Fl::system_driver()->pixmap_extra_transparent_processing(); uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color if (!fl_measure_pixmap(cdata, w, h)) @@ -140,7 +138,7 @@ int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { typedef uchar uchar4[4]; uchar4 *colors = new uchar4[1<<(chars_per_pixel*8)]; - if (use_extra_transparent_processing) { + if (Fl_Graphics_Driver::need_pixmap_bg_color) { color_count = 0; used_colors = (UsedColor*)malloc(abs(ncolors) * sizeof(UsedColor)); } @@ -153,14 +151,14 @@ int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { if (*p == ' ') { uchar* c = colors[(int)' ']; Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; - if (use_extra_transparent_processing) transparent_c = c; + if (Fl_Graphics_Driver::need_pixmap_bg_color) transparent_c = c; p += 4; ncolors--; } // read all the rest of the colors: for (int i=0; i < ncolors; i++) { uchar* c = colors[*p++]; - if (use_extra_transparent_processing) { + if (Fl_Graphics_Driver::need_pixmap_bg_color) { used_colors[color_count].r = *(p+0); used_colors[color_count].g = *(p+1); used_colors[color_count].b = *(p+2); @@ -195,7 +193,7 @@ int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]); c[3] = 255; if (parse) { - if (use_extra_transparent_processing) { + if (Fl_Graphics_Driver::need_pixmap_bg_color) { used_colors[color_count].r = c[0]; used_colors[color_count].g = c[1]; used_colors[color_count].b = c[2]; @@ -206,16 +204,16 @@ int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { // "bg" should be transparent... Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; - if (use_extra_transparent_processing) transparent_c = c; + if (Fl_Graphics_Driver::need_pixmap_bg_color) transparent_c = c; } // if parse } // for ncolors } // if ncolors - if (use_extra_transparent_processing) { + if (Fl_Graphics_Driver::need_pixmap_bg_color) { if (transparent_c) { - Fl::system_driver()->make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); + fl_graphics_driver->make_unused_color_(transparent_c[0], transparent_c[1], transparent_c[2]); } else { uchar r, g, b; - Fl::system_driver()->make_unused_color(r, g, b); + fl_graphics_driver->make_unused_color_(r, g, b); } } |
