aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpContour.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-05-18 05:12:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-18 05:12:56 -0700
commit5b5ddd73b4baf22752924bf20d097e96236c36f8 (patch)
treee4ae4c9db97d4a19fe504b9aabf5f6d373aeeffa /src/pathops/SkOpContour.cpp
parent2e0303f91bdada6dddb73105a82f17601265379d (diff)
The path ops builder code needs to determine the winding of each contour added, and reverse windings if the contours are nested in other contours.
Cheap (one contour) paths can be evaluated and reversed as needed with a minimum of checking, but multi-contour paths invoke the regular path ops machinery to determine who is contained by whom. More tests need to be added to verify that all corner cases are considered, but this fixes the cases in the bug thus far. R=fmalita@chromium.org TBR=reed@google.com BUG=skia:3838 Review URL: https://codereview.chromium.org/1129193006
Diffstat (limited to 'src/pathops/SkOpContour.cpp')
-rw-r--r--src/pathops/SkOpContour.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pathops/SkOpContour.cpp b/src/pathops/SkOpContour.cpp
index 178ba3e89c..18b6328a7e 100644
--- a/src/pathops/SkOpContour.cpp
+++ b/src/pathops/SkOpContour.cpp
@@ -47,6 +47,16 @@ void SkOpContour::toPath(SkPathWriter* path) const {
path->close();
}
+void SkOpContour::toReversePath(SkPathWriter* path) const {
+ const SkPoint& pt = fTail->pts()[0];
+ path->deferredMove(pt);
+ const SkOpSegment* segment = fTail;
+ do {
+ segment->addCurveTo(segment->tail(), segment->head(), path, true);
+ } while ((segment = segment->prev()));
+ path->close();
+}
+
SkOpSegment* SkOpContour::undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr) {
SkOpSegment* segment = &fHead;
do {