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-07 17:23:51 +0000
commitdd8313d5be4fe4dd0defdf3eb78e2b47f0e2f20e (patch)
tree5974ee574efe3f708f7494366aa8295f49122001
parent6a6cdccee43288e2abb6a6e16e4e911062911374 (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 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 b8bbdefa37..8215255cf5 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -247,6 +247,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)
@@ -333,6 +338,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) {
@@ -394,7 +400,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->setRedBlueSwizzle(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);