diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-01-05 14:57:35 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-01-07 15:17:00 +0000 |
commit | 6f69a313bd03c4a96f3efcd1ea00068fd5d572e9 (patch) | |
tree | 01ddf2c44bb8f24baf78c6c9323603c61ed7872a /src/gui/painting | |
parent | b2203b2490031aa13ed90c73c8414081896b649c (diff) |
Fix offset and size for native child rtt widgets
Render-to-texture widgets that are native children may have a non-zero
offset telling the position within the top-level widget. The size is
usually different (smaller) than the tlw's size as well.
An unfortunate optimization attempt led to ignoring the size for native
children with offset (0, 0). This resulted in interesting rendering
artifacts whenever such widgets were placed in the top-left corner of
the toplevel. This is now corrected.
Task-number: QTBUG-48130
Change-Id: If449610c3f3333cb73ae149efaefd7ef42953951
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index cda2446a5e..4b725fc79f 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -371,17 +371,13 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i if (textureId) { if (d_ptr->needsSwizzle) d_ptr->blitter->setSwizzleRB(true); - // offset is usually (0, 0) unless we have native child widgets. - if (offset.isNull()) { - d_ptr->blitter->blit(textureId, QMatrix4x4(), origin); - } else { - // The backingstore is for the entire tlw. offset tells the position of the native child in the tlw. - const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height()); - const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window), - d_ptr->textureSize, - origin); - d_ptr->blitter->blit(textureId, QMatrix4x4(), source); - } + // 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 QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window), + d_ptr->textureSize, + origin); + d_ptr->blitter->blit(textureId, QMatrix4x4(), source); if (d_ptr->needsSwizzle) d_ptr->blitter->setSwizzleRB(false); } |