QOpenGLTextureBlitter: fix source rect when origin is top left
This fixes the issue that the blitter required sometimes the texture wrapping to be repeat Change-Id: I86150d008422facf9040873b0983b0e44be9ad24 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
937a4f5443
commit
44ee7984fc
@ -210,6 +210,7 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
|
|||||||
if (textureMatrixUniformState != IdentityFlipped) {
|
if (textureMatrixUniformState != IdentityFlipped) {
|
||||||
QMatrix3x3 flipped;
|
QMatrix3x3 flipped;
|
||||||
flipped(1,1) = -1;
|
flipped(1,1) = -1;
|
||||||
|
flipped(1,2) = 1;
|
||||||
program->setUniformValue(textureTransformUniformPos, flipped);
|
program->setUniformValue(textureTransformUniformPos, flipped);
|
||||||
textureMatrixUniformState = IdentityFlipped;
|
textureMatrixUniformState = IdentityFlipped;
|
||||||
}
|
}
|
||||||
@ -375,8 +376,8 @@ QMatrix3x3 QOpenGLTextureBlitter::sourceTransform(const QRectF &subTexture,
|
|||||||
qreal y_translate = topLeft.y() / textureSize.height();
|
qreal y_translate = topLeft.y() / textureSize.height();
|
||||||
|
|
||||||
if (origin == OriginTopLeft) {
|
if (origin == OriginTopLeft) {
|
||||||
y_translate += (y_translate * 2) + y_scale;
|
y_scale = -y_scale;
|
||||||
y_scale = y_scale - 1;
|
y_translate = 1 - y_translate;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMatrix3x3 matrix;
|
QMatrix3x3 matrix;
|
||||||
|
@ -81,6 +81,7 @@ void QOpenGLTextureBlitWindow::render()
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
QOpenGLTexture texture(m_image);
|
QOpenGLTexture texture(m_image);
|
||||||
|
texture.setWrapMode(QOpenGLTexture::ClampToEdge);
|
||||||
texture.create();
|
texture.create();
|
||||||
|
|
||||||
QOpenGLTexture texture_mirrored(m_image_mirrord);
|
QOpenGLTexture texture_mirrored(m_image_mirrord);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user