Allow overriding the maximum cached glyph size via the environment

Useful for testing.

Change-Id: I8cfd4453018cba0301287ad6a1c15a88cdc33c1c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-12-05 17:10:34 +01:00
parent e12aad05f0
commit 2e715c31ed

View File

@ -1090,9 +1090,14 @@ bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTran
if (fontEngine->glyphFormat == QFontEngine::Format_ARGB)
return true;
static const int maxCachedGlyphSizeSquared = std::pow([]{
if (int env = qEnvironmentVariableIntValue("QT_MAX_CACHED_GLYPH_SIZE"))
return env;
return QT_MAX_CACHED_GLYPH_SIZE;
}(), 2);
qreal pixelSize = fontEngine->fontDef.pixelSize;
return (pixelSize * pixelSize * qAbs(m.determinant())) <
QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
return (pixelSize * pixelSize * qAbs(m.determinant())) < maxCachedGlyphSizeSquared;
}
QT_END_NAMESPACE