summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-03-05 01:52:10 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-03-05 01:52:10 (GMT)
commit2f8141dc3c922619bbe577902c2ef8a9e2195d70 (patch)
treee58efd16acc2f3ff7f6da68afa66af8b685209da
parent7f243aa938498837e32b318a38d81d9cca4b8fe0 (diff)
downloadQt-2f8141dc3c922619bbe577902c2ef8a9e2195d70.zip
Qt-2f8141dc3c922619bbe577902c2ef8a9e2195d70.tar.gz
Qt-2f8141dc3c922619bbe577902c2ef8a9e2195d70.tar.bz2
Image drawing in OpenVG was off by 0.5 of a pixel
Path transforms need to be adjusted by 0.5 for the difference in OpenVG and Qt co-ordinate systems. Image transforms do not need to be adjusted because OpenVG implicitly adjusts by 0.5. Task-number: QT-2999 Reviewed-by: Sarah Smith
-rw-r--r--src/openvg/qpaintengine_vg.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index c46bc27..4a97a6f 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -516,14 +516,11 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
0.0f, -1.0f, 0.0f,
0.5f, devh + 0.5f, 1.0f);
- // The image transform is always the full transformation,
- // because it can be projective.
- imageTransform = transform * viewport;
-
- // Determine if the transformation is projective.
- bool projective = (imageTransform.m13() != 0.0f ||
- imageTransform.m23() != 0.0f ||
- imageTransform.m33() != 1.0f);
+ // Compute the path transform and determine if it is projective.
+ pathTransform = transform * viewport;
+ bool projective = (pathTransform.m13() != 0.0f ||
+ pathTransform.m23() != 0.0f ||
+ pathTransform.m33() != 1.0f);
if (projective) {
// The engine cannot do projective path transforms for us,
// so we will have to convert the co-ordinates ourselves.
@@ -531,11 +528,19 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
pathTransform = viewport;
simpleTransform = false;
} else {
- pathTransform = imageTransform;
simpleTransform = true;
}
pathTransformSet = false;
+ // The image transform is always the full transformation,
+ // because it can be projective. It also does not need the
+ // (0.5, -0.5) translation because vgDrawImage() implicitly
+ // adds 0.5 to each co-ordinate.
+ QTransform viewport2(1.0f, 0.0f, 0.0f,
+ 0.0f, -1.0f, 0.0f,
+ 0.0f, devh, 1.0f);
+ imageTransform = transform * viewport2;
+
// Calculate the scaling factor to use for turning cosmetic pens
// into ordinary non-cosmetic pens.
qt_scaleForTransform(transform, &penScale);