summaryrefslogtreecommitdiff
path: root/src/gui/painting/qpaintengineex.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-12-05 17:10:34 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-12-08 15:27:16 +0000
commit2e715c31ed3a37fc196e97d4c58d0e277b1b9215 (patch)
tree03549049b639b061f5203b5fb05bca4c61c7008c /src/gui/painting/qpaintengineex.cpp
parente12aad05f039ddaefd444f80246845090ef9ce13 (diff)
downloadqtbase-2e715c31ed3a37fc196e97d4c58d0e277b1b9215.tar.gz
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>
Diffstat (limited to 'src/gui/painting/qpaintengineex.cpp')
-rw-r--r--src/gui/painting/qpaintengineex.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 9f07af92e4..f4cbf15fc7 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