diff options
author | David Boddie <dboddie@trolltech.com> | 2010-06-10 12:56:11 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-06-10 12:56:11 (GMT) |
commit | 19e19142d8a56ba880dca869c5721ea8f72fea16 (patch) | |
tree | ba18b0ac8ec954bc905af5a9adb1be00b6da1bbc /src/openvg | |
parent | 95fcfccf3c6d9d102fa1c5481e6be52a21749af6 (diff) | |
parent | 7101ae5a0e90d97acf86a444c4d51ca45e7863fe (diff) | |
download | Qt-19e19142d8a56ba880dca869c5721ea8f72fea16.zip Qt-19e19142d8a56ba880dca869c5721ea8f72fea16.tar.gz Qt-19e19142d8a56ba880dca869c5721ea8f72fea16.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/openvg')
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 45 |
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) |