summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2019-06-19 12:54:46 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2019-06-19 13:12:59 +0200
commit1975a98345d96b6155b651bba65eb8ae8ca30d92 (patch)
tree2da21c203d6a3f3796c2819edf08e484349fc9d3
parent084f84d112dc3dc61de958027ba05508220756d4 (diff)
macOS: prevent duplicate backing store scaling
m_requestedSize is already scaled by the QtGui scale factor (e.g. as set by QT_SCALE_FACTOR). Multiplying by QWindow::devicePixelRatio() then applies this factor again. Use QPlatformWindow::devicePixelRatio() instead, which returns the platform scale factor. Change-Id: I133e99d84f4718215fda9ef0cf81a113b51db2c7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 233ccfab9e..78aa98094c 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -413,10 +413,11 @@ void QCALayerBackingStore::ensureBackBuffer()
bool QCALayerBackingStore::recreateBackBufferIfNeeded()
{
- const qreal devicePixelRatio = window()->devicePixelRatio();
+ const QCocoaWindow *platformWindow = static_cast<QCocoaWindow *>(window()->handle());
+ const qreal devicePixelRatio = platformWindow->devicePixelRatio();
QSize requestedBufferSize = m_requestedSize * devicePixelRatio;
- const NSView *backingStoreView = static_cast<QCocoaWindow *>(window()->handle())->view();
+ const NSView *backingStoreView = platformWindow->view();
Q_UNUSED(backingStoreView);
auto bufferSizeMismatch = [&](const QSize requested, const QSize actual) {