Don't overwrite flipped textureTransform with unflipped on next blit

The logic introduced in 60d9509cb0 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>
bb10
Tor Arne Vestbø 2021-11-30 21:27:50 +01:00
parent a88b53f713
commit d281274c3f
1 changed files with 5 additions and 4 deletions

View File

@ -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);
}