devdraw: fake dpi calculation on Mac R=rsc http://codereview.appspot.com/6782115
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index c6389e9..f771861 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m
@@ -396,6 +396,14 @@ [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; }