src/gui/text/qfontengine_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
--- a/src/gui/text/qfontengine_p.h	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/text/qfontengine_p.h	Tue Feb 02 00:43:10 2010 +0200
@@ -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"
 
@@ -219,9 +220,7 @@
     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);
-    void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data);
-    QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const;
-    QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const;
+    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 @@
     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)