aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
diff options
context:
space:
mode:
authorGlenn Watson <glenn.watson@nokia.com>2012-03-01 08:57:32 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-01 07:55:06 +0100
commit22a5c42b83c5bff8d3b47b3b7f0d096fa212d0a6 (patch)
tree75a46d3e2ce762d800c0cf17b469ffc38487a1cb /src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
parentae4c3c14e2535fbbf439c2baeb4333bbc21c2a96 (diff)
Fix material compare for distance field glyph nodes.
The compare function did not take into account the GL texture ID when comparing materials. This could result in a renderer merging glyph nodes into a single batch incorrectly. Change-Id: Ib62c43f93fb1bbbc231197323dced4254ffa12aa Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp')
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index e525d2a458..f9c8349c2c 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -233,7 +233,11 @@ int QSGDistanceFieldTextMaterial::compare(const QSGMaterial *o) const
}
QRgb c1 = m_color.rgba();
QRgb c2 = other->m_color.rgba();
- return int(c2 < c1) - int(c1 < c2);
+ if (c1 != c2)
+ return int(c2 < c1) - int(c1 < c2);
+ int t0 = m_texture ? m_texture->textureId : -1;
+ int t1 = other->m_texture ? other->m_texture->textureId : -1;
+ return t0 - t1;
}