diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qtextureglyphcache_p.h | 5 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 4 | ||||
-rw-r--r-- | src/gui/text/qfontengineglyphcache_p.h | 7 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 |
5 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 57473d1..bb0c630 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -76,7 +76,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache { public: QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix) - : QFontEngineGlyphCache(matrix), m_w(0), m_h(0), m_cx(0), m_cy(0), m_type(type) { } + : QFontEngineGlyphCache(matrix, type), m_w(0), m_h(0), m_cx(0), m_cy(0) { } virtual ~QTextureGlyphCache() { } @@ -98,8 +98,6 @@ public: virtual void resizeTextureData(int width, int height) = 0; virtual int glyphMargin() const { return 0; } - QFontEngineGlyphCache::Type cacheType() const { return m_type; } - virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0; inline void createCache(int width, int height) { @@ -121,7 +119,6 @@ protected: int m_h; // image height int m_cx; // current x int m_cy; // current y - QFontEngineGlyphCache::Type m_type; }; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 27fc3c1..0eadf04 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -742,14 +742,15 @@ void QFontEngine::expireGlyphCache() } } -void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data) +void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type) { Q_ASSERT(data); QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key); for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) { QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) { + if (qtransform_equals_no_translate(c->m_transform, data->m_transform) + && c->cacheType() == type) { if (c == data) return; items.removeAll(c); @@ -786,13 +787,14 @@ void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyp expireGlyphCache(); } -QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform) const +QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const { QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key); for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) { QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, transform)) { + if (qtransform_equals_no_translate(c->m_transform, transform) + && type == c->cacheType()) { m_glyphCacheQueue.removeAll(c); // last used, move it up m_glyphCacheQueue.append(c); return c; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 728c344..62bff85 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -218,9 +218,9 @@ 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); + void setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type); void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data); - QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const; + QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const; QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const; static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h index e04f4ac..c6112ba 100644 --- a/src/gui/text/qfontengineglyphcache_p.h +++ b/src/gui/text/qfontengineglyphcache_p.h @@ -75,17 +75,20 @@ QT_BEGIN_NAMESPACE class QFontEngineGlyphCache { public: - QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { } - enum Type { Raster_RGBMask, Raster_A8, Raster_Mono }; + QFontEngineGlyphCache(const QTransform &matrix, Type type) : m_transform(matrix), m_type(type) { } + virtual ~QFontEngineGlyphCache() { } + Type cacheType() const { return m_type; } + QTransform m_transform; + QFontEngineGlyphCache::Type m_type; }; typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash; typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 17af9cb..9f42217 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1562,11 +1562,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform()); + (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform(), glyphType); if (!cache || cache->cacheType() != glyphType) { cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); - ti.fontEngine->setGlyphCache(ctx, cache); + ti.fontEngine->setGlyphCache(ctx, cache, glyphType); } cache->setPaintEnginePrivate(this); |