aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/PlatCocoa.h2
-rw-r--r--cocoa/PlatCocoa.mm10
2 files changed, 9 insertions, 3 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index 3e0aa09d8..0653bc728 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -49,6 +49,8 @@ private:
/** The text layout instance */
QuartzTextLayout* textLayout;
int codePage;
+ int verticalDeviceResolution;
+
/** If the surface is a bitmap context, contains a reference to the bitmap data. */
uint8_t* bitmapData;
/** If the surface is a bitmap context, stores the dimensions of the bitmap. */
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index f7db513c6..1f8a54a4c 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -384,9 +384,13 @@ CGImageRef SurfaceImpl::GetImage()
*/
int SurfaceImpl::LogPixelsY()
{
- NSSize deviceResolution = [[[[NSScreen mainScreen] deviceDescription]
- objectForKey: NSDeviceResolution] sizeValue];
- return (int) deviceResolution.height;
+ if (verticalDeviceResolution == 0)
+ {
+ NSSize deviceResolution = [[[[NSScreen mainScreen] deviceDescription]
+ objectForKey: NSDeviceResolution] sizeValue];
+ verticalDeviceResolution = (int) deviceResolution.height;
+ }
+ return verticalDeviceResolution;
}
//--------------------------------------------------------------------------------------------------