QFontEngine: Cache whether or not a font can be smoothly scaled

This will be used by QtQuick to correct a performance regression introduced by
592614ea3e -- QFontDatabase::isSmoothlyScalable is
quite computationally expensive; and now it is unconditionally expensive
regardless of the platform.

Change-Id: I82bfa65a963c6c3c276d574f2b379da4a9ba5b69
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Robin Burchell 2016-11-11 15:29:28 +01:00
parent 628d367a9d
commit f2205c48c2
3 changed files with 4 additions and 1 deletions

View File

@ -948,8 +948,8 @@ QFontEngine *loadSingleEngine(int script,
return 0;
}
engine->isSmoothlyScalable = style->smoothScalable;
fontCache->insertEngine(key, engine);
return engine;
}
}
@ -972,6 +972,7 @@ QFontEngine *loadSingleEngine(int script,
return 0;
}
engine->isSmoothlyScalable = style->smoothScalable;
fontCache->insertEngine(key, engine);
if (Q_LIKELY(cacheForCommonScript && !engine->symbol)) {

View File

@ -251,6 +251,7 @@ QFontEngine::QFontEngine(Type type)
cache_cost = 0;
fsType = 0;
symbol = false;
isSmoothlyScalable = false;
glyphFormat = Format_None;
m_subPixelPositionCount = 0;

View File

@ -283,6 +283,7 @@ public:
uint cache_cost; // amount of mem used in bytes by the font
uint fsType : 16;
bool symbol;
bool isSmoothlyScalable;
struct KernPair {
uint left_right;
QFixed adjust;