From d1ee7189553e13337b198fe4ba66d79fb7a7f41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Feb 2013 18:16:49 +0100 Subject: Add support for color glyphs (Emoji) on Mac OS X and iOS A new glyph type is added to the glyph caches for ARGB bitmap glyphs, and the raster and OpenGL paint engines have been modified to support this glyph type for drawCachedGlyphs(). The CoreText font engine implements support for these glyphs through the CTFontDrawGlyphs API, since CGContextShowGlyphsWithAdvances does not handle color glyphs. Change-Id: Idad9ce75a911cae130d65aebe59142772a16fc12 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui/painting/qpaintengine_raster.cpp') diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index b9202e1612..fd867ebde6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2857,7 +2857,19 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, // x, y, // positions[i].x.toInt(), positions[i].y.toInt()); - alphaPenBlt(bits + ((c.x << leftShift) >> rightShift) + c.y * bpl, bpl, depth, x, y, c.w, c.h); + const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl; + + if (glyphType == QFontEngineGlyphCache::Raster_ARGB) { + // The current state transform has already been applied to the positions, + // so we prevent drawImage() from re-applying the transform by clearing + // the state for the duration of the call. + QTransform originalTransform = s->matrix; + s->matrix = QTransform(); + drawImage(QPoint(x, y), QImage(glyphBits, c.w, c.h, bpl, image.format())); + s->matrix = originalTransform; + } else { + alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h); + } } } return true; -- cgit v1.2.3