diff options
author | Andreas Kling <andreas.kling@nokia.com> | 2010-03-05 13:12:18 (GMT) |
---|---|---|
committer | Andreas Kling <andreas.kling@nokia.com> | 2010-03-05 15:30:54 (GMT) |
commit | 56c9bd9a4c03418ad0ba83b576bcc278e86bfe99 (patch) | |
tree | d9a1046f44a4b3083a4862c0dbd9db877d06c8b2 /src/gui/text/qfontengine_ft_p.h | |
parent | 1fdaff30cde418a858170547e9d3c514617ba366 (diff) | |
download | Qt-56c9bd9a4c03418ad0ba83b576bcc278e86bfe99.zip Qt-56c9bd9a4c03418ad0ba83b576bcc278e86bfe99.tar.gz Qt-56c9bd9a4c03418ad0ba83b576bcc278e86bfe99.tar.bz2 |
FreeType: Fast lookup of Latin-1 glyphs
Store all glyphs with index < 256 in a pointer array for fast lookup
Reviewed-by: Benjamin Poulain
Diffstat (limited to 'src/gui/text/qfontengine_ft_p.h')
-rw-r--r-- | src/gui/text/qfontengine_ft_p.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 98dd002..12b7da8 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -180,7 +180,21 @@ public: FT_Matrix transformationMatrix; unsigned long id; // server sided id, GlyphSet for X11 bool outline_drawing; + + void removeGlyphFromCache(int index); + void clear(); + inline Glyph *getGlyph(int index) const + { + if (index < 256) + return fast_glyph_data[index]; + return glyph_data.value(index); + } + void setGlyph(int index, Glyph *glyph); + +private: mutable QHash<int, Glyph *> glyph_data; // maps from glyph index to glyph data + mutable Glyph *fast_glyph_data[256]; // for fast lookup of glyphs < 256 + mutable int fast_glyph_count; }; virtual QFontEngine::FaceId faceId() const; @@ -252,7 +266,7 @@ public: QGlyphSet *defaultGlyphs() { return &defaultGlyphSet; } GlyphFormat defaultGlyphFormat() const { return defaultFormat; } - inline Glyph *cachedGlyph(glyph_t g) const { return defaultGlyphSet.glyph_data.value(g); } + inline Glyph *cachedGlyph(glyph_t g) const { return defaultGlyphSet.getGlyph(g); } QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); bool loadGlyphs(QGlyphSet *gs, glyph_t *glyphs, int num_glyphs, GlyphFormat format = Format_Render); |