summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/platformcompositor
diff options
context:
space:
mode:
authorMichal Klocek <Michal.Klocek@qt.io>2019-04-11 14:37:44 +0200
committerMichal Klocek <michal.klocek@qt.io>2019-04-16 12:50:56 +0000
commit4298658bef89fb79974530bfa3723a48a6bf7efc (patch)
treed2e2eec13118ed914de1551797b476481f7bcf5d /src/platformsupport/platformcompositor
parente4d2c74aad2a04208981355ee1698dcf08b8cd95 (diff)
Fix corner case in openglcompositor for eglfs
Add 'source' window offset. This covers the cases where platform window is created besides one full screen window (like for popups), where content has qquickwidget / qopenglwidgtet. In that case fbos/textures from those widgets have offset according to 'source' window. Note backingstore texture has geometry of 'source' window. Task-number: QTBUG-69533 Change-Id: I2514b36fd3a6b9b86f51999df1c2b3e9565aafde Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/platformsupport/platformcompositor')
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositor.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/platformsupport/platformcompositor/qopenglcompositor.cpp b/src/platformsupport/platformcompositor/qopenglcompositor.cpp
index 0f4946f81a..635bf0107f 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositor.cpp
+++ b/src/platformsupport/platformcompositor/qopenglcompositor.cpp
@@ -188,14 +188,15 @@ static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
topLeftRect.width(), topLeftRect.height());
}
-static void clippedBlit(const QPlatformTextureList *textures, int idx, const QRect &targetWindowRect,
+static void clippedBlit(const QPlatformTextureList *textures, int idx, const QRect &sourceWindowRect,
+ const QRect &targetWindowRect,
QOpenGLTextureBlitter *blitter, QMatrix4x4 *rotationMatrix)
{
const QRect clipRect = textures->clipRect(idx);
if (clipRect.isEmpty())
return;
- const QRect rectInWindow = textures->geometry(idx);
+ const QRect rectInWindow = textures->geometry(idx).translated(sourceWindowRect.topLeft());
const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
@@ -218,7 +219,7 @@ void QOpenGLCompositor::render(QOpenGLCompositorWindow *window)
const QRect targetWindowRect(QPoint(0, 0), m_targetWindow->geometry().size());
float currentOpacity = 1.0f;
BlendStateBinder blend;
-
+ const QRect sourceWindowRect = window->sourceWindow()->geometry();
for (int i = 0; i < textures->count(); ++i) {
uint textureId = textures->textureId(i);
const float opacity = window->sourceWindow()->opacity();
@@ -243,16 +244,16 @@ void QOpenGLCompositor::render(QOpenGLCompositorWindow *window)
target = m_rotationMatrix * target;
m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
- // Texture from an FBO belonging to a QOpenGLWidget
+ // Texture from an FBO belonging to a QOpenGLWidget or QQuickWidget
blend.set(false);
- clippedBlit(textures, i, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
+ clippedBlit(textures, i, sourceWindowRect, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
}
}
for (int i = 0; i < textures->count(); ++i) {
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
blend.set(true);
- clippedBlit(textures, i, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
+ clippedBlit(textures, i, sourceWindowRect, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
}
}