From 2e25ec139d6b2394650b165e71eba246423fb492 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 13 Jun 2019 15:10:14 +0200 Subject: Fix graphical artifacts after changing only texture If the size of the texture changes, but subrect stays the same, the geometry changed and is now dirty. Change-Id: I5a4de88fd3f788a686fb2186185da2a0a3faad82 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/util/qsgdefaultimagenode.cpp | 4 ++++ src/quick/scenegraph/util/qsgdefaultimagenode_p.h | 1 + 2 files changed, 5 insertions(+) (limited to 'src/quick') diff --git a/src/quick/scenegraph/util/qsgdefaultimagenode.cpp b/src/quick/scenegraph/util/qsgdefaultimagenode.cpp index 7186ee4265..48ec8f01d3 100644 --- a/src/quick/scenegraph/util/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/util/qsgdefaultimagenode.cpp @@ -156,6 +156,10 @@ void QSGDefaultImageNode::setTexture(QSGTexture *texture) m_isAtlasTexture = texture->isAtlasTexture(); if (wasAtlas || m_isAtlasTexture) dirty |= DirtyGeometry; + // The geometry has also changed if the texture size changed. + if (m_textureSize != texture->textureSize()) + dirty |= DirtyGeometry; + m_textureSize = texture->textureSize(); markDirty(dirty); } diff --git a/src/quick/scenegraph/util/qsgdefaultimagenode_p.h b/src/quick/scenegraph/util/qsgdefaultimagenode_p.h index cb23e759d3..7b26daf541 100644 --- a/src/quick/scenegraph/util/qsgdefaultimagenode_p.h +++ b/src/quick/scenegraph/util/qsgdefaultimagenode_p.h @@ -95,6 +95,7 @@ private: QSGTextureMaterial m_material; QRectF m_rect; QRectF m_sourceRect; + QSize m_textureSize; TextureCoordinatesTransformMode m_texCoordMode; uint m_isAtlasTexture : 1; uint m_ownsTexture : 1; -- cgit v1.2.3