diff options
Diffstat (limited to 'src/openvg/qpaintengine_vg.cpp')
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 4b22d5e..4992ef5 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -44,6 +44,7 @@ #include "qpixmapfilter_vg_p.h" #include "qvgcompositionhelper_p.h" #include "qvgimagepool_p.h" +#include "qvgfontglyphcache_p.h" #if !defined(QT_NO_EGL) #include <QtGui/private/qeglcontext_p.h> #include "qwindowsurface_vgegl_p.h" @@ -80,24 +81,6 @@ Q_DECL_IMPORT extern int qt_defaultDpiY(); class QVGPaintEnginePrivate; -class QVGFontGlyphCache -{ -public: - QVGFontGlyphCache(); - ~QVGFontGlyphCache(); - - void cacheGlyphs(QVGPaintEnginePrivate *d, QFontEngine *fontEngine, const glyph_t *g, int count); - - void setScaleFromText(const QFont &font, QFontEngine *fontEngine); - - VGFont font; - VGfloat scaleX; - VGfloat scaleY; - - uint cachedGlyphsMask[256 / 32]; - QSet<glyph_t> cachedGlyphs; -}; - typedef QHash<QFontEngine*, QVGFontGlyphCache*> QVGFontCache; #endif @@ -3289,6 +3272,7 @@ QVGFontGlyphCache::QVGFontGlyphCache() { font = vgCreateFont(0); scaleX = scaleY = 0.0; + invertedGlyphs = false; memset(cachedGlyphsMask, 0, sizeof(cachedGlyphsMask)); } @@ -3423,7 +3407,11 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) if (it != d->fontCache.constEnd()) { glyphCache = it.value(); } else { +#ifdef Q_OS_SYMBIAN + glyphCache = new QSymbianVGFontGlyphCache(); +#else glyphCache = new QVGFontGlyphCache(); +#endif if (glyphCache->font == VG_INVALID_HANDLE) { qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine"); delete glyphCache; @@ -3443,6 +3431,11 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) #if defined(QVG_NO_IMAGE_GLYPHS) glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY); #endif + + // Some glyph caches can create the VGImage upright + if (glyphCache->invertedGlyphs) + glyphTransform.scale(1, -1); + d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, glyphTransform); // Add the glyphs from the text item into the glyph cache. |