diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-26 00:00:13 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-11-26 00:00:13 (GMT) |
commit | 7dec702b4ac6fba07640959a0666ab1b44e25f07 (patch) | |
tree | e640b2e533c69ea9878f63f2aeecce3d604a01a0 /src/gui/painting | |
parent | d8ee9ddffa4e0cad8c1d991ab6fb84b705c075e5 (diff) | |
parent | ccebbb663a1b21204057d8b799de3ddf1b63307e (diff) | |
download | Qt-7dec702b4ac6fba07640959a0666ab1b44e25f07.zip Qt-7dec702b4ac6fba07640959a0666ab1b44e25f07.tar.gz Qt-7dec702b4ac6fba07640959a0666ab1b44e25f07.tar.bz2 |
Merge branch 'master-upstream' into master-water
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 17 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache_p.h | 4 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 4a6c03f..de59524 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -117,7 +117,7 @@ QFixed QTextureGlyphCache::subPixelPositionForX(QFixed x) const return subPixelPosition; } -void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, +bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions) { #ifdef CACHE_DEBUG @@ -196,7 +196,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const rowHeight = qMax(rowHeight, glyph_height); } if (listItemCoordinates.isEmpty()) - return; + return true; rowHeight += margin * 2 + paddingDoubled; @@ -238,6 +238,8 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const m_cx += c.w + paddingDoubled; ++iter; } + return true; + } void QTextureGlyphCache::fillInPendingGlyphs() @@ -368,11 +370,14 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP } #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) { diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 82aaf0d..4227e9a 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -109,7 +109,7 @@ public: int baseLineY; }; - void populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, + bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions); void fillInPendingGlyphs(); @@ -137,7 +137,7 @@ public: QHash<GlyphAndSubPixelPosition, Coord> coords; virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; } - virtual int maxTextureHeight() const { return 32768; } + virtual int maxTextureHeight() const { return -1; } QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const; |