diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-12-10 09:41:53 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-12-10 09:41:53 (GMT) |
commit | ab5d00edea76d3b1d38d6e7e59159042ec69f2f2 (patch) | |
tree | 43acf3c547a465e657e4621616562f7f9e3ce5fb /src/gui/text/qfontengine_p.h | |
parent | 16de24d638deafb6e985b531fdf0c15691c0b7b4 (diff) | |
download | Qt-ab5d00edea76d3b1d38d6e7e59159042ec69f2f2.zip Qt-ab5d00edea76d3b1d38d6e7e59159042ec69f2f2.tar.gz Qt-ab5d00edea76d3b1d38d6e7e59159042ec69f2f2.tar.bz2 |
Clean up the QFontEngine glyphcaching code to not crash and be more tidy
Reviewed-by: Eskil
Diffstat (limited to 'src/gui/text/qfontengine_p.h')
-rw-r--r-- | src/gui/text/qfontengine_p.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 62bff85..a9883b4 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -56,6 +56,7 @@ #include "QtCore/qglobal.h" #include "QtCore/qatomic.h" #include <QtCore/qvarlengtharray.h> +#include <QtCore/QLinkedList> #include "private/qtextengine_p.h" #include "private/qfont_p.h" @@ -218,10 +219,8 @@ public: virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); - void setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type); - void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data); - QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const; - QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const; + void setGlyphCache(void *key, QFontEngineGlyphCache *data); + QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const; static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode); @@ -254,12 +253,13 @@ protected: static const QVector<QRgb> &grayPalette(); private: - /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones. - void expireGlyphCache(); + struct GlyphCacheEntry { + void *context; + QFontEngineGlyphCache *cache; + bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; } + }; - GlyphPointerHash m_glyphPointerHash; - GlyphIntHash m_glyphIntHash; - mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue; + mutable QLinkedList<GlyphCacheEntry> m_glyphCaches; }; inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2) |