summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp8
-rw-r--r--src/gui/text/qfontengine_ft.cpp5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 828dbc318c..12631b3a73 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -76,7 +76,9 @@
QT_BEGIN_NAMESPACE
-
+#ifndef QFONTCACHE_DECREASE_TRIGGER_LIMIT
+# define QFONTCACHE_DECREASE_TRIGGER_LIMIT 256
+#endif
bool QFontDef::exactMatch(const QFontDef &other) const
{
@@ -2800,7 +2802,7 @@ void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineDa
engineData->ref.ref();
// Decrease now rather than waiting
- if (total_cost > min_cost * 2)
+ if (total_cost > min_cost * 2 && engineDataCache.size() >= QFONTCACHE_DECREASE_TRIGGER_LIMIT)
decreaseCache();
engineDataCache.insert(def, engineData);
@@ -2849,7 +2851,7 @@ void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMu
#endif
engine->ref.ref();
// Decrease now rather than waiting
- if (total_cost > min_cost * 2)
+ if (total_cost > min_cost * 2 && engineCache.size() >= QFONTCACHE_DECREASE_TRIGGER_LIMIT)
decreaseCache();
Engine data(engine);
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 26ed81a091..51b1418bc3 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1849,7 +1849,10 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
Q_UNREACHABLE();
};
- return QImage(static_cast<const uchar *>(glyph->data), glyph->width, glyph->height, bytesPerLine, format);
+ QImage img(static_cast<const uchar *>(glyph->data), glyph->width, glyph->height, bytesPerLine, format);
+ if (format == QImage::Format_Mono)
+ img.setColor(1, QColor(Qt::white).rgba()); // Expands color table to 2 items; item 0 set to transparent.
+ return img;
}
QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixelPosition,