summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-09-04 15:17:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-05 09:48:22 +0200
commit35bc3dc45aacaf36a8bdfccc7627136cc2e5b185 (patch)
tree355aa9a3e4d56c42f1c068cc66caa9e6fcaa059b /src/gui/painting
parent0b481f28d19e9ae8389f535c70865658a5e7e189 (diff)
Rely solely on alphaMapBoundingBox in QTextureGlyphCache
We're currently adding a lot of transparent pixels to the cache, wasting both memory and cpu cycles while drawing. AlphaMapBoundingBox was introduced to return the exact same bounds as the alphaMapForGlyph function so we should only rely on this instead of adding arbitrary padding and margins all over the place. Windows still has an arbitrary +4 in the its drawGDIGlyph() which means batching will not work on windows, but at least now other platforms do not need to suffer. Change-Id: I714903fa195004400c09c3bf6570e46179775f09 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 6676d3daa6..2166ae7975 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -108,7 +108,6 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
#endif
m_current_fontengine = fontEngine;
- const int margin = m_current_fontengine->glyphMargin(m_type);
const int padding = glyphPadding();
const int paddingDoubled = padding * 2;
@@ -174,8 +173,6 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
coords.insert(key, c);
continue;
}
- glyph_width += margin * 2 + 4;
- glyph_height += margin * 2 + 4;
// align to 8-bit boundary
if (m_type == QFontEngineGlyphCache::Raster_Mono)
glyph_width = (glyph_width+7)&~7;
@@ -192,7 +189,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
if (listItemCoordinates.isEmpty())
return true;
- rowHeight += margin * 2 + paddingDoubled;
+ rowHeight += paddingDoubled;
if (m_w == 0) {
if (fontEngine->maxCharWidth() <= QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH)
@@ -207,7 +204,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
while (iter != listItemCoordinates.end()) {
Coord c = iter.value();
- m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2);
+ m_currentRowHeight = qMax(m_currentRowHeight, c.h);
if (m_cx + c.w + padding > requiredWidth) {
int new_width = requiredWidth*2;
@@ -219,7 +216,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
// no room on the current line, start new glyph strip
m_cx = padding;
m_cy += m_currentRowHeight + paddingDoubled;
- m_currentRowHeight = c.h + margin * 2; // New row
+ m_currentRowHeight = c.h; // New row
}
}