summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-06-01 17:45:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-06-08 12:08:03 +0000
commita896d04eead3778377bfcd5c87c37e4461554a74 (patch)
tree51a60c9f4335f1356563c844b0e152df45f6461f
parentee04c572bbd9db28daa6a8eaba7f1d46d109ace7 (diff)
Translate the adjusted deviceWindowRect with an adjusted offset
Otherwise the mismatched device pixel ratio will lead to incorrectly offset blitting. Task-number: QTBUG-59017 Change-Id: Iccbe9cd9704bccbceda4c8dafe87435b68b5cf3e (cherry picked from commit dd8313d5be4fe4dd0defdf3eb78e2b47f0e2f20e) Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index defdcfb4ad..dc1026a88c 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -239,6 +239,11 @@ static inline QRect deviceRect(const QRect &rect, QWindow *window)
return deviceRect;
}
+static inline QPoint deviceOffset(const QPoint &pt, QWindow *window)
+{
+ return pt * window->devicePixelRatio();
+}
+
static QRegion deviceRegion(const QRegion &region, QWindow *window, const QPoint &offset)
{
if (offset.isNull() && window->devicePixelRatio() <= 1)
@@ -326,6 +331,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->bind();
const QRect deviceWindowRect = deviceRect(QRect(QPoint(), window->size()), window);
+ const QPoint deviceWindowOffset = deviceOffset(offset, window);
// Textures for renderToTexture widgets.
for (int i = 0; i < textures->count(); ++i) {
@@ -387,7 +393,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->setSwizzleRB(true);
// The backingstore is for the entire tlw.
// In case of native children offset tells the position relative to the tlw.
- const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height());
+ const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(deviceWindowOffset), d_ptr->textureSize.height());
const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect,
d_ptr->textureSize,
origin);