From 2e715c31ed3a37fc196e97d4c58d0e277b1b9215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Dec 2018 17:10:34 +0100 Subject: [PATCH] Allow overriding the maximum cached glyph size via the environment Useful for testing. Change-Id: I8cfd4453018cba0301287ad6a1c15a88cdc33c1c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengineex.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9f07af92e40..f4cbf15fc70 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -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