opengl: Invalidate cached vbo when content transform is different

When output rotation changes, the texture size stays the same, but the
texture coordinates are no longer valid and have to be recomputed.
This commit is contained in:
Vlad Zahorodnii 2024-02-15 13:00:50 +02:00
parent c6a3d76b92
commit 5d787a4083
2 changed files with 3 additions and 1 deletions

View file

@ -349,9 +349,10 @@ void GLTexture::render(const QRectF &source, const QRegion &region, const QSizeF
}
const QSize destinationSize = targetSize.toSize(); // TODO: toSize is not enough to snap to the pixel grid, fix render() users and drop this toSize
if (targetSize != d->m_cachedSize || d->m_cachedSource != source) {
if (targetSize != d->m_cachedSize || d->m_cachedSource != source || d->m_cachedContentTransform != d->m_textureToBufferTransform) {
d->m_cachedSize = destinationSize;
d->m_cachedSource = source;
d->m_cachedContentTransform = d->m_textureToBufferTransform;
const float texWidth = (target() == GL_TEXTURE_RECTANGLE_ARB) ? width() : 1.0f;
const float texHeight = (target() == GL_TEXTURE_RECTANGLE_ARB) ? height() : 1.0f;

View file

@ -54,6 +54,7 @@ public:
std::unique_ptr<GLVertexBuffer> m_vbo;
QSizeF m_cachedSize;
QRectF m_cachedSource;
OutputTransform m_cachedContentTransform;
static void initStatic();