aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-08-03 20:42:44 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-12 17:03:08 +0200
commit0bf62bd47bfda33305153a808619550e6a5b896f (patch)
treeeff3bfae6a4559e4fcb2cd81cfd4cb254429a56a /src/quick/scenegraph/util/qsgsimpletexturenode.cpp
parent876080d89d3c5bf7b0441f73d5234be36e656113 (diff)
Fix QSGSimpleTextureNode's dirty signals for atlas textures
When used in an atlas, changing the texture also changes the geometry. Change-Id: I744eb0ef58aed9f3a5e51ea89c4da1fad5824633 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/util/qsgsimpletexturenode.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index e5b351ead6..a50cfa9494 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -51,9 +51,11 @@ public:
QSGSimpleTextureNodePrivate()
: QSGGeometryNodePrivate()
, m_texCoordMode(QSGSimpleTextureNode::NoTransform)
+ , isAtlasTexture(false)
{}
QSGSimpleTextureNode::TextureCoordinatesTransformMode m_texCoordMode;
+ uint isAtlasTexture : 1;
};
static void qsgsimpletexturenode_update(QSGGeometry *g,
@@ -177,7 +179,16 @@ void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
m_opaque_material.setTexture(texture);
Q_D(QSGSimpleTextureNode);
qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->m_texCoordMode);
- markDirty(DirtyMaterial);
+
+ DirtyState dirty = DirtyMaterial;
+ // It would be tempting to skip the extra bit here and instead use
+ // m_material.texture to get the old state, but that texture could
+ // have been deleted in the mean time.
+ bool wasAtlas = d->isAtlasTexture;
+ d->isAtlasTexture = texture->isAtlasTexture();
+ if (wasAtlas || d->isAtlasTexture)
+ dirty |= DirtyGeometry;
+ markDirty(dirty);
}