From 750d00aba7e49b6093bc273924ba688cb433b505 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 28 Aug 2023 17:30:37 +0200 Subject: Fix backing store compositor transform with Vulkan The problem does not become apparent until a QQuickWidget or QRhiWidget using Vulkan is put into a QScrollArea and then attempted to be scrolled vertically. Fixes: QTBUG-116338 Pick-to: 6.6 6.5 Change-Id: I55367b51aaf2bb8d039bf5e313a0d8c3d7908327 Reviewed-by: Andy Nichols Reviewed-by: Qt CI Bot --- src/gui/painting/qbackingstoredefaultcompositor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qbackingstoredefaultcompositor.cpp b/src/gui/painting/qbackingstoredefaultcompositor.cpp index 03b169aa3d..0d0e3bfcd2 100644 --- a/src/gui/painting/qbackingstoredefaultcompositor.cpp +++ b/src/gui/painting/qbackingstoredefaultcompositor.cpp @@ -173,7 +173,7 @@ static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport, b matrix(1,3) = y_translate; matrix(0,0) = x_scale; - matrix(1,1) = y_scale; + matrix(1,1) = (invertY ? -1.0 : 1.0) * y_scale; return matrix; } @@ -543,8 +543,9 @@ QPlatformBackingStore::FlushResult QBackingStoreDefaultCompositor::flush(QPlatfo const qreal dpr = window->devicePixelRatio(); const QRect deviceWindowRect = scaledRect(QRect(QPoint(), window->size()), dpr); - const bool invertTargetY = rhi->clipSpaceCorrMatrix().data()[5] < 0.0f; - const bool invertSource = rhi->isYUpInFramebuffer() != rhi->isYUpInNDC(); + const bool invertTargetY = !rhi->isYUpInNDC(); + const bool invertSource = !rhi->isYUpInFramebuffer(); + if (m_texture) { // The backingstore is for the entire tlw. In case of native children, offset tells the position // relative to the tlw. The window rect is scaled by the source device pixel ratio to get -- cgit v1.2.3