summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h5
-rw-r--r--src/gui/text/qfontengine.cpp10
-rw-r--r--src/gui/text/qfontengine_p.h4
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h7
4 files changed, 14 insertions, 12 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;