diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-11 18:16:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-13 02:04:16 +0100 |
commit | d1ee7189553e13337b198fe4ba66d79fb7a7f41d (patch) | |
tree | 2260be276c82026558086596f396f7fc0922106f /src/gui/painting/qtextureglyphcache.cpp | |
parent | a65157e5b7a2a1c2f018507f9d45f5b311cd387c (diff) |
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 <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/painting/qtextureglyphcache.cpp')
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 2ffdc9cd59..8769aeaba9 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -129,6 +129,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const switch (m_type) { case Raster_A8: format = QFontEngine::Format_A8; break; case Raster_RGBMask: format = QFontEngine::Format_A32; break; + case Raster_ARGB: format = QFontEngine::Format_ARGB; break; default: format = QFontEngine::Format_Mono; break; } @@ -275,6 +276,8 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition { if (m_type == QFontEngineGlyphCache::Raster_RGBMask) return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform); + else if (m_type == QFontEngineGlyphCache::Raster_ARGB) + return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform); return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform); } @@ -306,6 +309,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) m_image = QImage(width, height, QImage::Format_RGB32); break; case QFontEngineGlyphCache::Raster_ARGB: + m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied); break; } } @@ -322,7 +326,8 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask + || m_type == QFontEngineGlyphCache::Raster_ARGB) { 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()); |