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>
This commit is contained in:
Morten Johan Sørvig 2019-06-19 12:54:46 +02:00
parent 084f84d112
commit 1975a98345

View File

@ -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) {