diff options
author | Russ Cox <rsc@swtch.com> | 2012-11-25 23:55:27 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2012-11-25 23:55:27 -0500 |
commit | 58b1904e3eec4d80a9a30e4267d902b523351aec (patch) | |
tree | 4b246b77446108eb86b725d87bcdc12e0f11fd6b | |
parent | cc9547960e7cf12129e84c9489eb5dcd6235144b (diff) | |
download | plan9port-58b1904e3eec4d80a9a30e4267d902b523351aec.tar.gz plan9port-58b1904e3eec4d80a9a30e4267d902b523351aec.tar.bz2 plan9port-58b1904e3eec4d80a9a30e4267d902b523351aec.zip |
devdraw: fake dpi calculation on Mac
R=rsc
http://codereview.appspot.com/6782115
-rw-r--r-- | src/cmd/devdraw/cocoa-screen.m | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index c6389e9b..f7718612 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m @@ -396,6 +396,14 @@ initimg(void) [win.img setSize: ptsize]; win.topixelscale = size.width / ptsize.width; win.topointscale = 1.0f / win.topixelscale; + + // NOTE: This is not really the display DPI. + // On retina, topixelscale is 2; otherwise it is 1. + // This formula gives us 220 for retina, 110 otherwise. + // That's not quite right but it's close to correct. + // http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple + displaydpi = win.topixelscale * 110; + return i; } |