summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-07-15 10:46:56 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-07-15 10:46:56 (GMT)
commitdd3deac9990a92730e998c6ae282fe02cde5a700 (patch)
tree5136088d70a7fe010e59b99288f068d4770107b6 /macosx/tkMacOSXDraw.c
parent96e1dfb2816cd8f2790d1a533b7065735fd3c7bf (diff)
downloadtk-dd3deac9990a92730e998c6ae282fe02cde5a700.zip
tk-dd3deac9990a92730e998c6ae282fe02cde5a700.tar.gz
tk-dd3deac9990a92730e998c6ae282fe02cde5a700.tar.bz2
Fix for image/alpha rendering under hidpi/Retina displays on Mac OS; thanks to Marc Culler for assistance
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index d9b909b..f48538d 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -399,9 +399,11 @@ TkPutImage(
CGImageRef img = CreateCGImageWithXImage(image);
if (img) {
+ /* If the XImage has big pixels, rescale the source dimensions.*/
+ int pp = image->pixelpower;
DrawCGImage(d, gc, dc.context, img, gc->foreground, gc->background,
- CGRectMake(0, 0, image->width, image->height),
- CGRectMake(src_x, src_y, width, height),
+ CGRectMake(0, 0, image->width<<pp, image->height<<pp),
+ CGRectMake(src_x<<pp, src_y<<pp, width<<pp, height<<pp),
CGRectMake(dest_x, dest_y, width, height));
CFRelease(img);
} else {