aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-06-05 10:05:37 +1000
committernyamatongwe <devnull@localhost>2011-06-05 10:05:37 +1000
commit4caa54e400ac5b80b966d7a8f08b801223b4a221 (patch)
treeec6ce23df2a6f5dd175beda66c2e8215f594ca29 /cocoa/PlatCocoa.mm
parent93ed8a4c28c170852779e926730108c9fa64faf6 (diff)
downloadscintilla-mirror-4caa54e400ac5b80b966d7a8f08b801223b4a221.tar.gz
Cache surface resolution as it is slow and is called
for every font creation.
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm10
1 files changed, 7 insertions, 3 deletions
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;
}
//--------------------------------------------------------------------------------------------------