aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-11-24 13:48:19 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-24 13:03:03 +0100
commit47a5c708bf4e555cb8febef583f32c99f7d8ea1e (patch)
tree722842be890fe711a353759b100ac50bef9c2648 /src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
parent635d0a7cf6601b2e46e0eed21a648934bc471c6d (diff)
Add support for shared glyph cache
Use a shared graphics cache to back the distance fields if it is available. Change-Id: Id5e6e7a28e38e349d787e66016b2d0faebc791d7 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdistancefieldglyphnode.cpp')
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index 8f681d2a0b..eb1c1eb22d 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -57,10 +57,10 @@ QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGDistanceFieldGlyphCacheM
, m_dirtyGeometry(false)
, m_dirtyMaterial(false)
{
- setFlag(UsePreprocess);
m_geometry.setDrawingMode(GL_TRIANGLES);
setGeometry(&m_geometry);
setPreferredAntialiasingMode(cacheManager->defaultAntialiasingMode());
+ setFlag(UsePreprocess);
#ifdef QML_RUNTIME_TESTING
description = QLatin1String("glyphs");
#endif
@@ -112,9 +112,13 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR
QSGDistanceFieldGlyphCache *oldCache = m_glyph_cache;
m_glyph_cache = m_glyph_cacheManager->cache(m_glyphs.rawFont());
if (m_glyph_cache != oldCache) {
- if (oldCache)
+ Q_ASSERT(ownerElement() != 0);
+ if (oldCache) {
oldCache->unregisterGlyphNode(this);
+ oldCache->unregisterOwnerElement(ownerElement());
+ }
m_glyph_cache->registerGlyphNode(this);
+ m_glyph_cache->registerOwnerElement(ownerElement());
}
m_glyph_cache->populate(glyphs.glyphIndexes());
@@ -158,12 +162,13 @@ void QSGDistanceFieldGlyphNode::preprocess()
{
Q_ASSERT(m_glyph_cache);
- m_glyph_cache->update();
-
for (int i = 0; i < m_nodesToDelete.count(); ++i)
delete m_nodesToDelete.at(i);
m_nodesToDelete.clear();
+ m_glyph_cache->processPendingGlyphs();
+ m_glyph_cache->update();
+
if (m_dirtyGeometry)
updateGeometry();
}
@@ -285,6 +290,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
QHash<const QSGDistanceFieldGlyphCache::Texture *, QSGDistanceFieldGlyphNode *>::iterator subIt = m_subNodes.find(ite.key());
if (subIt == m_subNodes.end()) {
QSGDistanceFieldGlyphNode *subNode = new QSGDistanceFieldGlyphNode(m_glyph_cacheManager);
+ subNode->setOwnerElement(m_ownerElement);
subNode->setColor(m_color);
subNode->setStyle(m_style);
subNode->setStyleColor(m_styleColor);