summaryrefslogtreecommitdiffstats
path: root/src/openvg/qpaintengine_vg.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-09 06:32:07 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-06-09 06:32:07 (GMT)
commitf2eab026602a0608e036018eeacf3fa6c8ca3fa7 (patch)
tree97be8a8e269ea49fb68d4908d8f7d0f47afbd1d6 /src/openvg/qpaintengine_vg.cpp
parent22d7c82b71f34df637efd0ed39b3d63719a2bf67 (diff)
parent17fcc84e5ebcf09f80a4bbebafde913d0422a91e (diff)
downloadQt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.zip
Qt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.tar.gz
Qt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/openvg/qpaintengine_vg.cpp')
-rw-r--r--src/openvg/qpaintengine_vg.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 76a605a..4b22d5e 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -1622,11 +1622,48 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
QRectF rect(points[0], points[1], points[2] - points[0],
points[5] - points[1]);
clip(rect.toRect(), op);
- } else {
- // The best we can do is clip to the bounding rectangle
- // of all control points.
- clip(path.controlPointRect().toRect(), op);
+ return;
+ }
+
+ // Try converting the path into a QRegion that tightly follows
+ // the outline of the path we want to clip with.
+ QRegion region(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon());
+ switch (op) {
+ case Qt::NoClip:
+ {
+ region = defaultClipRegion();
+ }
+ break;
+
+ case Qt::ReplaceClip:
+ {
+ region = d->transform.map(region);
+ }
+ break;
+
+ case Qt::IntersectClip:
+ {
+ region = s->clipRegion.intersect(d->transform.map(region));
+ }
+ break;
+
+ case Qt::UniteClip:
+ {
+ region = s->clipRegion.unite(d->transform.map(region));
+ }
+ break;
}
+ if (region.numRects() <= d->maxScissorRects) {
+ // We haven't reached the maximum scissor count yet, so we can
+ // still make use of this region.
+ s->clipRegion = region;
+ updateScissor();
+ return;
+ }
+
+ // The best we can do is clip to the bounding rectangle
+ // of all control points.
+ clip(path.controlPointRect().toRect(), op);
}
void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)