summaryrefslogtreecommitdiffstats
path: root/src/openvg/qvg_symbian.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/qvg_symbian.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/qvg_symbian.cpp')
-rw-r--r--src/openvg/qvg_symbian.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp
index e6086d0..8c954e6 100644
--- a/src/openvg/qvg_symbian.cpp
+++ b/src/openvg/qvg_symbian.cpp
@@ -322,6 +322,11 @@ void* QVGPixmapData::toNativeType(NativeType type)
return 0;
}
+QSymbianVGFontGlyphCache::QSymbianVGFontGlyphCache() : QVGFontGlyphCache()
+{
+ invertedGlyphs = true;
+}
+
void QSymbianVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
const QTextItemInt &ti,
const QVarLengthArray<glyph_t> &glyphs)
@@ -359,7 +364,7 @@ void QSymbianVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
VGfloat origin[2];
VGfloat escapement[2];
origin[0] = -glyphBounds.iTl.iX + 0.5f;
- origin[1] = -glyphBounds.iTl.iY + 0.5f;
+ origin[1] = glyphBounds.iBr.iY + 0.5f;
escapement[0] = metrics.HorizAdvance();
escapement[1] = 0;
vgSetGlyphToImage(font, iter.GlyphCode(), vgImage, origin, escapement);