From dd8313d5be4fe4dd0defdf3eb78e2b47f0e2f20e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 1 Jun 2017 17:45:02 +0200 Subject: 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 --- src/gui/painting/qplatformbackingstore.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gui/painting/qplatformbackingstore.cpp') 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 ®ion, QWindow *window, const QPoint &offset) { if (offset.isNull() && window->devicePixelRatio() <= 1) @@ -333,6 +338,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i 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 ®i 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); -- cgit v1.2.3