diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-11-30 21:27:50 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-12-01 15:03:34 +0100 |
commit | d281274c3fe21d1054725c6c190881ab064784f6 (patch) | |
tree | 211b9201deec7d09f07a9e74a67e52260bd3a605 | |
parent | a88b53f713a564be833d8b744beb5889be1d8ecc (diff) |
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 <lorn.potter@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/opengl/qopengltextureblitter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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); } |