aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgadaptationlayer_p.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2012-06-06 17:52:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-08 13:11:24 +0200
commit2fdc5e044c967ac7044a3b5814110469da20f6e4 (patch)
treea216d38886929766cb96421d7664f34d30dd1ce7 /src/quick/scenegraph/qsgadaptationlayer_p.h
parent1535da8a5923b5829b945cc9fd1dee4cdfbcfe5e (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_p.h')
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index 3c62ce03dd..c1b2afc8fa 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -189,7 +189,7 @@ public:
}
int distanceFieldRadius() const
{
- return QT_DISTANCEFIELD_DEFAULT_RADIUS / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);
+ return QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);
}
int glyphCount() const { return m_glyphCount; }
bool doubleGlyphResolution() const { return m_doubleGlyphResolution; }
@@ -216,6 +216,15 @@ protected:
QPointF position;
};
+ struct GlyphData {
+ Texture *texture;
+ TexCoord texCoord;
+ QRectF boundingRect;
+ quint32 ref;
+
+ GlyphData() : texture(0), ref(0) { }
+ };
+
virtual void requestGlyphs(const QSet<glyph_t> &glyphs) = 0;
virtual void storeGlyphs(const QHash<glyph_t, QImage> &glyphs) = 0;
virtual void referenceGlyphs(const QSet<glyph_t> &glyphs) = 0;
@@ -231,20 +240,11 @@ protected:
inline bool containsGlyph(glyph_t glyph);
GLuint textureIdForGlyph(glyph_t glyph) const;
+ GlyphData &glyphData(glyph_t glyph);
+
QOpenGLContext *ctx;
private:
- struct GlyphData {
- Texture *texture;
- TexCoord texCoord;
- QRectF boundingRect;
- quint32 ref;
-
- GlyphData() : texture(0), ref(0) { }
- };
-
- GlyphData &glyphData(glyph_t glyph);
-
QSGDistanceFieldGlyphCacheManager *m_manager;
QRawFont m_referenceFont;
@@ -255,6 +255,7 @@ private:
QList<Texture> m_textures;
QHash<glyph_t, GlyphData> m_glyphsData;
QDataBuffer<glyph_t> m_pendingGlyphs;
+ QSet<glyph_t> m_populatingGlyphs;
QLinkedList<QSGDistanceFieldGlyphConsumer*> m_registeredNodes;
static Texture s_emptyTexture;