summaryrefslogtreecommitdiffstats
path: root/src/openvg/qpaintengine_vg.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2010-02-26 12:47:45 (GMT)
committerJason Barron <jbarron@trolltech.com>2010-07-12 07:03:09 (GMT)
commit8c6bfd9f2d34822e39812c07e821fa17ab3fdcb2 (patch)
tree6aa897a6c31bf8eb9611b039fc83f2b48a8a627e /src/openvg/qpaintengine_vg.cpp
parent940930dd8102511e6890ed661cf3d2dd88c2e1f4 (diff)
downloadQt-8c6bfd9f2d34822e39812c07e821fa17ab3fdcb2.zip
Qt-8c6bfd9f2d34822e39812c07e821fa17ab3fdcb2.tar.gz
Qt-8c6bfd9f2d34822e39812c07e821fa17ab3fdcb2.tar.bz2
Ensure glyphs are upright instead of upside-down.
The OpenVG paint engine traditionally takes glyph images from the alphaMapForGlyph() function which returns the glyph image in the upright projection. When it constructs a VGImage from this image, it passes a positive data stride which will read the top scanline of the source image into the bottom scanline of the VGImage due to the VG coordinate system. It then uses the path transform where the 'sy' value of the matrix is set to -1 and this re-inverts everything when drawing. With the Symbian based glyph cache, the VGImage is constructed from a RSgImage which is a hardware resource and compensates for the coordinate system used by VG and GL at the time it is created. In the case of the hardware glyph cache, the glyph image is read into the RSgImage using a negative data stride so it does not need to be inverted when drawn. To allow for this, introduce a flag which indicates that the 'sy' entry of the matrix should be flipped such that the glyph is drawn normally. Also in this patch is a change to the glyph origin which now uses the bottom of the glyph metric bounding rect instead of the top due to orientation of the glyph inside the VGImage. Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/openvg/qpaintengine_vg.cpp')
-rw-r--r--src/openvg/qpaintengine_vg.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 01c7a7e..4992ef5 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3272,6 +3272,7 @@ QVGFontGlyphCache::QVGFontGlyphCache()
{
font = vgCreateFont(0);
scaleX = scaleY = 0.0;
+ invertedGlyphs = false;
memset(cachedGlyphsMask, 0, sizeof(cachedGlyphsMask));
}
@@ -3430,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.