aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpContour.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@google.com>2016-12-16 17:17:25 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-16 22:47:00 +0000
commitab2d73b06fe6c518be1d399a79c9cc39db21abb6 (patch)
treeb0a7c6a51acbaeb6aaca55361a838daabd506003 /src/pathops/SkOpContour.cpp
parentee1c73fc1b8a616ac79572759b02435698171fbf (diff)
rework xor to be more like winding
Pathops is very well exercised with winding paths, but less so with xor (even odd) paths. Rewrite the xor main loop to look like the winding one to take advantage of the latter's bug fixes. TBR=reed@google.com BUG=skia:6041 Change-Id: Ied8d522254a327b1817b54f0abbf4414f5fab7da Reviewed-on: https://skia-review.googlesource.com/6228 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/pathops/SkOpContour.cpp')
-rw-r--r--src/pathops/SkOpContour.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/pathops/SkOpContour.cpp b/src/pathops/SkOpContour.cpp
index 98467c558c..62380ab4fa 100644
--- a/src/pathops/SkOpContour.cpp
+++ b/src/pathops/SkOpContour.cpp
@@ -31,15 +31,19 @@ void SkOpContour::toReversePath(SkPathWriter* path) const {
path->assemble();
}
-SkOpSegment* SkOpContour::undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr) {
- SkOpSegment* segment = &fHead;
+SkOpSpan* SkOpContour::undoneSpan() {
+ SkOpSegment* testSegment = &fHead;
+ bool allDone = true;
do {
- if (segment->done()) {
+ if (testSegment->done()) {
continue;
}
- segment->undoneSpan(startPtr, endPtr);
- return segment;
- } while ((segment = segment->next()));
+ allDone = false;
+ return testSegment->undoneSpan();
+ } while ((testSegment = testSegment->next()));
+ if (allDone) {
+ fDone = true;
+ }
return nullptr;
}