summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-12-16 08:35:06 +0100
committerDamiano Galassi <[email protected]>2017-12-16 08:35:06 +0100
commit573b5ab5dc9fe6d6ec3b8e97620df8c713964a0e (patch)
tree9bf3c6f2ad5d18e66209aec85fbdf5ab500af289 /macosx
parent45e03e376f81a4efaae52c4571f355a98fd5d4b1 (diff)
MacGui: fix preview window scale factor on retina displays.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBPreviewView.m17
1 files changed, 8 insertions, 9 deletions
diff --git a/macosx/HBPreviewView.m b/macosx/HBPreviewView.m
index e4d2ea630..8bd40ea87 100644
--- a/macosx/HBPreviewView.m
+++ b/macosx/HBPreviewView.m
@@ -165,19 +165,18 @@
{
// Set the picture size display fields below the Preview Picture
NSSize imageSize = NSMakeSize(CGImageGetWidth(self.image), CGImageGetHeight(self.image));
+ CGFloat backingScaleFactor = 1.0;
if (imageSize.width > 0 && imageSize.height > 0) {
- NSSize imageScaledSize = imageSize;
- if (self.window && self.window.backingScaleFactor != 1.0)
+ if (self.window)
{
- // HiDPI mode usually display everything
- // with douple pixel count, but we don't
- // want to double the size of the video
- imageScaledSize.height /= self.window.backingScaleFactor;
- imageScaledSize.width /= self.window.backingScaleFactor;
+ backingScaleFactor = self.window.backingScaleFactor;
}
-
+ // HiDPI mode usually display everything
+ // with douple pixel count, but we don't
+ // want to double the size of the video
+ NSSize imageScaledSize = NSMakeSize(imageSize.width / backingScaleFactor, imageSize.height / backingScaleFactor);
NSSize frameSize = self.frame.size;
if (self.showBorder == YES)
@@ -225,7 +224,7 @@
[NSAnimationContext endGrouping];
// Update the proprierties
- self.scale = self.pictureLayer.frame.size.width / imageSize.width;
+ self.scale = self.pictureLayer.frame.size.width / imageSize.width * backingScaleFactor;
self.pictureFrame = self.pictureLayer.frame;
}
}