summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-06-03 11:22:50 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2022-06-14 21:16:35 +0200
commitd38118c80828eecb3c0192404249c1fad5660792 (patch)
treeccc37dd1332a060a18a77851b90ee53b91d2a7d1 /src/opengl
parent373392eeb4199654e954f70ce919850f090d59bd (diff)
Make rhiFlush() support custom source DPR
The rhiFlush() implementation currently assumes that QWindow->devicePixelRatio() is the correct scale factor for transforming device independent window geometry to source geometry. However, this assumption does not hold if/when we add support for drawing to a rounded-up DPR, with a downscale later in the rhiFlush implementation. Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(), which is set to either QWindow::devicePixelRatio() or QWidget::devicePixelRatio(), depending on from where it is used. Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp to be scale*() functions instead which take a scale factor instead of a QWindow. Update call sites to use srouceDevicePixelRatio where that makes sense. Pick-to: 6.4 Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qopenglcompositorbackingstore.cpp2
-rw-r--r--src/opengl/qopenglcompositorbackingstore_p.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/opengl/qopenglcompositorbackingstore.cpp b/src/opengl/qopenglcompositorbackingstore.cpp
index c3b8eb375e..a5cc391e48 100644
--- a/src/opengl/qopenglcompositorbackingstore.cpp
+++ b/src/opengl/qopenglcompositorbackingstore.cpp
@@ -168,6 +168,7 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region
}
QPlatformBackingStore::FlushResult QOpenGLCompositorBackingStore::rhiFlush(QWindow *window,
+ qreal sourceDevicePixelRatio,
const QRegion &region,
const QPoint &offset,
QPlatformTextureList *textures,
@@ -178,6 +179,7 @@ QPlatformBackingStore::FlushResult QOpenGLCompositorBackingStore::rhiFlush(QWind
Q_UNUSED(region);
Q_UNUSED(offset);
Q_UNUSED(translucentBackground);
+ Q_UNUSED(sourceDevicePixelRatio);
m_rhi = rhi();
if (!m_rhi) {
diff --git a/src/opengl/qopenglcompositorbackingstore_p.h b/src/opengl/qopenglcompositorbackingstore_p.h
index 8573f70862..4512e2d589 100644
--- a/src/opengl/qopenglcompositorbackingstore_p.h
+++ b/src/opengl/qopenglcompositorbackingstore_p.h
@@ -44,6 +44,7 @@ public:
QImage toImage() const override;
FlushResult rhiFlush(QWindow *window,
+ qreal sourceDevicePixelRatio,
const QRegion &region,
const QPoint &offset,
QPlatformTextureList *textures,