diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2012-06-06 17:52:19 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-08 13:11:24 +0200 |
commit | 2fdc5e044c967ac7044a3b5814110469da20f6e4 (patch) | |
tree | a216d38886929766cb96421d7664f34d30dd1ce7 /src/quick/scenegraph/qsgadaptationlayer.cpp | |
parent | 1535da8a5923b5829b945cc9fd1dee4cdfbcfe5e (diff) |
Support for variable glyph width in QSGDefaultDistanceFieldGlyphCache.
The glyphs are not stored in a fixed 64x64px tile anymore.
Glyphs are stored in area equal to <glyph_width> + 10 (margin) x 64px.
Allocation is now done with QSGAreaAllocator.
When glyph recycling is needed, unused glyphs are freed until the new
glyph can fit in the cache.
Change-Id: I179a8f17bfe35468bdb63bca5113ea4d0f06c414
Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgadaptationlayer.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 5c7aae0b59..083a9fb602 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -117,21 +117,22 @@ void QSGDistanceFieldGlyphCache::populate(const QVector<glyph_t> &glyphs) ++gd.ref; referencedGlyphs.insert(glyphIndex); - if (gd.texCoord.isValid() || newGlyphs.contains(glyphIndex)) + if (gd.texCoord.isValid() || m_populatingGlyphs.contains(glyphIndex)) continue; - gd.texCoord.width = 0; - gd.texCoord.height = 0; + m_populatingGlyphs.insert(glyphIndex); - if (!gd.boundingRect.isEmpty()) + if (gd.boundingRect.isEmpty()) { + gd.texCoord.width = 0; + gd.texCoord.height = 0; + } else { newGlyphs.insert(glyphIndex); + } } - if (newGlyphs.isEmpty()) - return; - referenceGlyphs(referencedGlyphs); - requestGlyphs(newGlyphs); + if (!newGlyphs.isEmpty()) + requestGlyphs(newGlyphs); } void QSGDistanceFieldGlyphCache::release(const QVector<glyph_t> &glyphs) @@ -149,6 +150,8 @@ void QSGDistanceFieldGlyphCache::release(const QVector<glyph_t> &glyphs) void QSGDistanceFieldGlyphCache::update() { + m_populatingGlyphs.clear(); + if (m_pendingGlyphs.isEmpty()) return; |