diff options
Diffstat (limited to 'macosx/tkMacOSXImage.c')
-rw-r--r-- | macosx/tkMacOSXImage.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 02e8c54..adcb0f5 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -160,25 +160,20 @@ XGetImage( unsigned int bytes_per_row, size, row, n, m; unsigned int scalefactor=1, scaled_height=height, scaled_width=width; NSWindow *win = TkMacOSXDrawableWindow(drawable); - TkWindow *winPtr = TkMacOSXGetTkWindow(win); + MacDrawable *macDraw = ((MacDrawable*)drawable); static enum {unknown, no, yes} has_retina = unknown; - if (win && !winPtr) { + if (macDraw->flags & TK_DO_NOT_BLEND) { /* - * If this drawable has an associated NSWindow but does not have an - * associated Tk window then it must be a dock icon. We are being - * called by TkImgPhotoDisplay because it is displaying a photoimage - * with an alpha channel, e.g. one generated from a png file, as the - * dock icon. It is asking us to create a pixmap for the rectangle - * where the image will be drawn so that it can blend the photoimage - * with its background using the alpha values. But in the case of a - * dock icon, that background will be black, not transparent as it - * should be. - * - * By returning NULL here, we force TkImgPhotoDisplay to give up on - * trying to blend, and just copy the image pixels to the screen. That - * does the right thing for a dock icon, as it happens. - */ + * When called by TkImgPhotoDisplay we are being asked to return a + * background image to be blended with the photoimage using its alpha + * channel, if it has one. Returning NULL here makes TkImgPhotoDisplay + * simply copy the image data, including the alpha channel, rather than + * do any blending. For example, when creating an iconphoto from a + * photoimage with transparency we will be passed a newly created + * pixmap filled with black pixels. These should not be blended with + * the pixels in the photoimage. + */ return NULL; } |