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
This commit is contained in:
Manolo Gouy 2018-04-19 13:14:37 +00:00
parent 54b697cd49
commit 374ea9e9eb
4 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -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;