summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-07-15 10:47:18 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-07-15 10:47:18 (GMT)
commit2ae13e10ac2c3c86584cece38298da049533e803 (patch)
tree2709070b1ea361c2ed7993c57f868eadb0a34720 /macosx/tkMacOSXDraw.c
parentc32ea9203392ec7c24b873842e0d0d84b66830cc (diff)
downloadtk-2ae13e10ac2c3c86584cece38298da049533e803.zip
tk-2ae13e10ac2c3c86584cece38298da049533e803.tar.gz
tk-2ae13e10ac2c3c86584cece38298da049533e803.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 {