summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-04-19 13:14:37 +0000
committerManolo Gouy <Manolo>2018-04-19 13:14:37 +0000
commit374ea9e9eb01e5a4975edf6e7bebb70708f1bee1 (patch)
tree3f6a5bf3a0596ac4a37745601aab942bdc8f1cca
parent54b697cd49d3946ecd1f264c0741f36568822819 (diff)
Fix handling of bg argument of fl_draw_pixmap(char**, int , int , Fl_Color bg) during direct drawing of pixmap image data.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12859 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx2
-rw-r--r--src/drivers/PostScript/Fl_PostScript_image.cxx2
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx2
-rw-r--r--src/fl_draw_pixmap.cxx4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index f66adba1e..b393175a3 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -699,7 +699,7 @@ 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 **pbitmap = surf->driver()->mask_bitmap();
- *pbitmap = 0;
+ *pbitmap = (uchar*)1;// will instruct fl_draw_pixmap() to compute the image's mask
fl_draw_pixmap(img->data(), 0, 0, FL_BLACK);
uchar *bitmap = *pbitmap;
if (bitmap) {
diff --git a/src/drivers/PostScript/Fl_PostScript_image.cxx b/src/drivers/PostScript/Fl_PostScript_image.cxx
index c007d9460..7c977bdf7 100644
--- a/src/drivers/PostScript/Fl_PostScript_image.cxx
+++ b/src/drivers/PostScript/Fl_PostScript_image.cxx
@@ -575,7 +575,7 @@ void Fl_PostScript_Graphics_Driver::draw_pixmap(Fl_Pixmap * pxm,int XP, int YP,
const char * const * di =pxm->data();
int w,h;
if (!fl_measure_pixmap(di, w, h)) return;
- mask=0;
+ mask=(uchar*)1;// will instruct fl_draw_pixmap() to compute the image's mask
mx = w;
my = h;
fl_draw_pixmap(di, 0, 0, FL_BLACK); // assigns mask to an array
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
index 05f3bd598..68cb70833 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
@@ -870,7 +870,7 @@ void Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *pxm) {
Fl_Image_Surface *surf = new Fl_Image_Surface(pxm->data_w(), pxm->data_h());
Fl_Surface_Device::push_current(surf);
uchar **pbitmap = surf->driver()->mask_bitmap();
- *pbitmap = 0;
+ *pbitmap = (uchar*)1;// will instruct fl_draw_pixmap() to compute the image's mask
fl_draw_pixmap(pxm->data(), 0, 0, FL_BLACK);
uchar *bitmap = *pbitmap;
if (bitmap) {
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index 735fe30c3..11ffe0f49 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -203,7 +203,7 @@ int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) {
// assume "None" or "#transparent" for any errors
// "bg" should be transparent...
Fl::get_color(bg, c[0], c[1], c[2]);
- c[3] = 0;
+ c[3] = 255;
if (Fl_Graphics_Driver::need_pixmap_bg_color) transparent_c = c;
} // if parse
} // for ncolors
@@ -254,7 +254,7 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
// build the mask bitmap used by Fl_Pixmap:
uchar **p = fl_graphics_driver->mask_bitmap();
- if (p) {
+ if (p && *p) {
int W = (w+7)/8;
uchar* bitmap = new uchar[W * h];
*p = bitmap;