From d281274c3fe21d1054725c6c190881ab064784f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 30 Nov 2021 21:27:50 +0100 Subject: Don't overwrite flipped textureTransform with unflipped on next blit The logic introduced in 60d9509cb00526e8530926b19b2366e584fdf30a didn't account for the fact that repeated blits with OriginTopLeft would only hit the code path that modified the source transform to flip it if the uniform state wasn't already IdentityFlipped. As a result, we would end up setting the unflipped texture transform on the next blit, even though the origin was still OriginTopLeft. Fixes: QTBUG-98803 Change-Id: Ib19e80e026acaa43981077b98ff942a7fa060378 Reviewed-by: Lorn Potter Reviewed-by: Lars Knoll --- src/opengl/qopengltextureblitter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/qopengltextureblitter.cpp b/src/opengl/qopengltextureblitter.cpp index 292b08a0a6..3153439dee 100644 --- a/src/opengl/qopengltextureblitter.cpp +++ b/src/opengl/qopengltextureblitter.cpp @@ -367,20 +367,21 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture, Program *program = &programs[targetToProgramIndex(currentTarget)]; - QMatrix3x3 sourceTransform; if (origin == QOpenGLTextureBlitter::OriginTopLeft) { if (program->textureMatrixUniformState != IdentityFlipped) { + QMatrix3x3 sourceTransform; sourceTransform(1,1) = -1; sourceTransform(1,2) = 1; + const QMatrix3x3 textureTransform = toTextureCoordinates(sourceTransform); + program->glProgram->setUniformValue(program->textureTransformUniformPos, textureTransform); program->textureMatrixUniformState = IdentityFlipped; } } else if (program->textureMatrixUniformState != Identity) { + const QMatrix3x3 textureTransform = toTextureCoordinates(QMatrix3x3()); + program->glProgram->setUniformValue(program->textureTransformUniformPos, textureTransform); program->textureMatrixUniformState = Identity; } - const QMatrix3x3 textureTransform = toTextureCoordinates(sourceTransform); - program->glProgram->setUniformValue(program->textureTransformUniformPos, textureTransform); - QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6); } -- cgit v1.2.3