summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qtextureglyphcache.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-11-19 14:38:58 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-11-19 14:38:58 +0100
commit649719c29bc3b33ab6a5eb9577d53bd0ba897550 (patch)
tree0674977bc66e6d1cec5f1434eb32c303f9aceb74 /src/gui/painting/qtextureglyphcache.cpp
parent72f161739b270b01807f97cd853030440f0fd430 (diff)
Fix possible missing glyphs in raster engine glyph cache
Two possible failures when using the glyph cache on raster engine and populating the cache with very many glyphs: 1. Change 72f161739b270b01807f97cd853030440f0fd430 caused the maximum height of the glyph cache to be 32768, which was not sufficient for large fonts with very many characters (e.g. Chinese text) 2. Since we are using QPainter to draw into the glyph cache for RGB32 glyphcaches, and QPainter does not support very high coordinates, we need to create a reference image that references a section of the glyph cache and paint into that instead. Task-number: QT-3971 Reviewed-by: Samuel
Diffstat (limited to 'src/gui/painting/qtextureglyphcache.cpp')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 2cd7780d56..2daa1f08b8 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -151,11 +151,11 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
while (new_height < m_cy + c.h)
new_height *= 2;
- if (new_height > maxTextureHeight()) {
- // We can't make a new texture of the required size, so
- // bail out
- return false;
- }
+ if (maxTextureHeight() > 0 && new_height > maxTextureHeight()) {
+ // We can't make a new texture of the required size, so
+ // bail out
+ return false;
+ }
// if no room in the current texture - realloc a larger texture
resizeTextureData(m_w, new_height);
@@ -266,11 +266,14 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)
}
#endif
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
- QPainter p(&m_image);
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
+ qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(),
+ m_image.format());
+ QPainter p(&ref);
p.setCompositionMode(QPainter::CompositionMode_Source);
- p.fillRect(c.x, c.y, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this
- p.drawImage(c.x, c.y, mask);
+ p.fillRect(0, 0, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this
+ p.drawImage(0, 0, mask);
p.end();
} else if (m_type == QFontEngineGlyphCache::Raster_Mono) {
if (mask.depth() > 1) {