summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex
diff options
context:
space:
mode:
authorSami Kyöstilä <sami.kyostila@nokia.com>2011-03-31 12:04:47 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-03-31 12:04:47 (GMT)
commita538389b52630ec53734695b8d422c5ec124b0bc (patch)
tree9bf6dd4a3986faca5c559b7edd59fb886c30999b /src/opengl/gl2paintengineex
parent8abc3cd80fd55c588faffb067ab51feb4b9b6fc5 (diff)
downloadQt-a538389b52630ec53734695b8d422c5ec124b0bc.zip
Qt-a538389b52630ec53734695b8d422c5ec124b0bc.tar.gz
Qt-a538389b52630ec53734695b8d422c5ec124b0bc.tar.bz2
opengl2: Make maximum cached glyph size configurable
As the DPI of displays continues to rise, especially on mobile devices, the maximum glyph size of 64 pixels for the glyph cache has become a limitation. This problem is made worse by the fact that when the maximum glyph size is exceeded, the OpenGL paint engine falls back to using rasterized geometry for glyph rendering. This does not produce acceptable quality if the OpenGL rendering surface lacks support for multisampling. This patch offers a solution to the problem by making the cached glyph size configurable at build time. This way the limit can be set according to the capabilities of the target hardware. Signed-off-by: Sami Kyöstilä <sami.kyostila@nokia.com> Merge-request: 1131 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 6678522..4d1d5dc 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -98,6 +98,10 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
extern bool qt_applefontsmoothing_enabled;
#endif
+#if !defined(QT_MAX_CACHED_GLYPH_SIZE)
+# define QT_MAX_CACHED_GLYPH_SIZE 64
+#endif
+
Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert);
////////////////////////////////// Private Methods //////////////////////////////////////////
@@ -1473,7 +1477,8 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
// don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
- if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f)
+ if (pixelSize * pixelSize * qAbs(det) >= QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE ||
+ det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0