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>
This commit is contained in:
parent
b2203b2490
commit
6f69a313bd
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user