diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-03-23 18:35:47 +0100 |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-03-24 15:56:56 +0100 |
commit | 47ce3672058d4cc6ca479f8b40d6cb821c38dd51 (patch) | |
tree | abb1c34a72e5f1cdc0206f87b23ac38c8fe85321 /src/gui/painting/qtextureglyphcache.cpp | |
parent | dcdc7eccf7ff32396816059dc932c358f73cf12b (diff) |
Fixed remaining issues in subpixel positioning with FreeType
1. Merge QStaticText and QGlyphs drawing code of raster engine
into glyph drawing code for normal QTextItem, it simplify
the caching system (we don't use QImageTextureGlyphCache for
raster anymore, just glyph set cache in FreeType engine is
enough), and fix some regressions in QStaticText and QGlyphs
drawing.
2. Fix subpixel positioning support for OpenGL texture glyph
cache. Including a transform handling regression introduced
by the initial patch.
3. Disable subpixel positioning for bitmap fonts (mono format).
After this change, we only have two code paths for glyph rendering
with FreeType: raster will always use the simple code path (with
QFontEngine_FT cache) while GL will always use QTextureGlyphCache.
Reviewed-by: Eskil
Diffstat (limited to 'src/gui/painting/qtextureglyphcache.cpp')
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index eab02e1d25..f0db805e1a 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -316,11 +316,11 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition QFontEngineFT *ft = static_cast<QFontEngineFT*> (m_current_fontengine); QFontEngineFT::QGlyphSet *gset = ft->loadTransformedGlyphSet(m_transform); - QFontEngineFT::Glyph *glyph = NULL; - if (gset) - glyph = ft->loadGlyph(gset, g, subPixelPosition, format); + QFixedPoint positions[1]; + positions[0].x = subPixelPosition; - if (glyph) { + if (gset && ft->loadGlyphs(gset, &g, 1, positions, format)) { + QFontEngineFT::Glyph *glyph = gset->getGlyph(g, subPixelPosition); const int bytesPerLine = (format == QFontEngineFT::Format_Mono ? ((glyph->width + 31) & ~31) >> 3 : (glyph->width + 3) & ~3); return QImage(glyph->data, glyph->width, glyph->height, bytesPerLine, imageFormat); @@ -367,7 +367,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) +#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) return 0; #else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; |