diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-06-19 12:54:46 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-06-19 13:12:59 +0200 |
commit | 1975a98345d96b6155b651bba65eb8ae8ca30d92 (patch) | |
tree | 2da21c203d6a3f3796c2819edf08e484349fc9d3 /src/plugins/platforms/cocoa/qcocoabackingstore.mm | |
parent | 084f84d112dc3dc61de958027ba05508220756d4 (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>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoabackingstore.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoabackingstore.mm | 5 |
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) { |