commit 58b1904e3eec4d80a9a30e4267d902b523351aec from: Russ Cox date: Mon Nov 26 04:55:27 2012 UTC devdraw: fake dpi calculation on Mac R=rsc http://codereview.appspot.com/6782115 commit - cc9547960e7cf12129e84c9489eb5dcd6235144b commit + 58b1904e3eec4d80a9a30e4267d902b523351aec blob - c6389e9ba8bc1d7f562bd95c750a7dad92c7aac8 blob + f77186129fde313b2f6422b2b34d7f33bc8dcc21 --- src/cmd/devdraw/cocoa-screen.m +++ 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; }