diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-17 12:28:15 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-21 13:22:19 (GMT) |
commit | e5d437d6899904de2596b0ece4914274cff37561 (patch) | |
tree | 213066bb8744e336624a27fd51be3aed91a01bf6 /src/gui/painting/qtextureglyphcache_p.h | |
parent | 49831f30f58d08a360d5947ba300aa3a3575d1fa (diff) | |
download | Qt-e5d437d6899904de2596b0ece4914274cff37561.zip Qt-e5d437d6899904de2596b0ece4914274cff37561.tar.gz Qt-e5d437d6899904de2596b0ece4914274cff37561.tar.bz2 |
Refactor QTextureGlyphCache
Separate getting the glyph coordinates from actually making and
populating the cache. Calling populate() and fillInPendingGlyphs()
immediately after should be equivalent to the old code, except it might
have fewer reallocations of the texture since you will only create it
one per set of glyphs.
This mainly enables populating the GL glyph cache outside a GL context
and then actually drawing into it later, when the context has actually
been established.
Reviewed-by: Kim
Diffstat (limited to 'src/gui/painting/qtextureglyphcache_p.h')
-rw-r--r-- | src/gui/painting/qtextureglyphcache_p.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index a818978..0770ed4 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -94,6 +94,7 @@ public: void populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions); + void fillInPendingGlyphs(); virtual void createTextureData(int width, int height) = 0; virtual void resizeTextureData(int width, int height) = 0; @@ -108,7 +109,14 @@ public: createTextureData(width, height); } - inline bool isNull() const { return m_w <= 0 || m_h <= 0; } + inline void resizeCache(int width, int height) + { + resizeTextureData(width, height); + m_w = width; + m_h = height; + } + + inline bool isNull() const { return m_h == 0; } QHash<glyph_t, Coord> coords; @@ -117,6 +125,8 @@ public: protected: QFontEngine *m_current_fontengine; + QHash<glyph_t, Coord> m_pendingGlyphs; + int m_w; // image width int m_h; // image height int m_cx; // current x |