Mac OS platform: make fl_draw_image() draw correctly depth-4 images with transparent areas.

This simplifies the drawing of Fl_Pixmap's.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11214 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-02-25 07:01:10 +00:00
parent 6097c134d8
commit 14759eb387
3 changed files with 2 additions and 15 deletions

View File

@ -85,8 +85,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
tmpBuf ? dataReleaseCB : NULL
);
CGImageRef img = CGImageCreate( W, H, 8, 8*delta, linedelta,
lut, delta&1?kCGImageAlphaNone:kCGImageAlphaNoneSkipLast,
//lut, delta&1?kCGImageAlphaNone:kCGImageAlphaLast,
lut, delta&1?kCGImageAlphaNone:kCGImageAlphaLast,
src, 0L, false, kCGRenderingIntentDefault);
// draw the image into the destination context
if (img) {

View File

@ -255,16 +255,6 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
return 0;
}
// FIXME: Hack until fl_draw_image() supports alpha properly
#ifdef __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap
if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) {
Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4);
rgb->alloc_array = 1;
rgb->draw(x, y);
delete rgb;
return 1;
} else {
#endif // __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap
// build the mask bitmap used by Fl_Pixmap:
if (fl_mask_bitmap) {
int W = (w+7)/8;
@ -289,9 +279,6 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
fl_draw_image(buffer, x, y, w, h, 4);
#ifdef __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap
}
#endif
delete[] buffer;
return 1;
}

View File

@ -565,6 +565,7 @@ void copy(Fl_Widget *, void *data) {
}
rgb_surf = new Fl_Image_Surface(W, H, 1);
rgb_surf->set_current();
fl_color(FL_YELLOW);fl_rectf(0,0,1000,1000);
if (decorated)
rgb_surf->draw_decorated_window(target->as_window());
else