summaryrefslogtreecommitdiffstats
path: root/src/openvg/qpaintengine_vg.cpp
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2010-06-10 04:37:54 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2010-06-10 04:37:54 (GMT)
commitb2cfa7ceaba6f6aef3f9d01f82f8aba95ba45cd6 (patch)
treec84ba40e7e2b5505d4c46a1f144529b0d05f9769 /src/openvg/qpaintengine_vg.cpp
parenta4df1784086ee086e64b35fc1d2df827704708be (diff)
parentbe68f6960f7665c715ea4cca90c2ea4ccae1e0fa (diff)
downloadQt-b2cfa7ceaba6f6aef3f9d01f82f8aba95ba45cd6.zip
Qt-b2cfa7ceaba6f6aef3f9d01f82f8aba95ba45cd6.tar.gz
Qt-b2cfa7ceaba6f6aef3f9d01f82f8aba95ba45cd6.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.6
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 07f8415..cfc481e 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -1626,11 +1626,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)