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>
bb10
Allan Sandfeld Jensen 2017-06-01 17:45:02 +02:00
parent 6a6cdccee4
commit dd8313d5be
1 changed files with 7 additions and 1 deletions

View File

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