aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpContour.h
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.h
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.h')
-rw-r--r--src/pathops/SkOpContour.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pathops/SkOpContour.h b/src/pathops/SkOpContour.h
index dd5dbb40ca..f8143cf555 100644
--- a/src/pathops/SkOpContour.h
+++ b/src/pathops/SkOpContour.h
@@ -207,10 +207,21 @@ public:
SkDEBUGCODE(fID = globalState->nextContourID());
}
+ int isCcw() const {
+ return fCcw;
+ }
+
bool isXor() const {
return fXor;
}
+ void markDone() {
+ SkOpSegment* segment = &fHead;
+ do {
+ segment->markAllDone();
+ } while ((segment = segment->next()));
+ }
+
void missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocator) {
SkASSERT(fCount > 0);
SkOpSegment* segment = &fHead;
@@ -289,6 +300,18 @@ public:
SkDEBUGCODE(fDebugIndent = 0);
}
+ void resetReverse() {
+ SkOpContour* next = this;
+ do {
+ next->fCcw = -1;
+ next->fReverse = false;
+ } while ((next = next->next()));
+ }
+
+ bool reversed() const {
+ return fReverse;
+ }
+
void setBounds() {
SkASSERT(fCount > 0);
const SkOpSegment* segment = &fHead;
@@ -298,6 +321,10 @@ public:
}
}
+ void setCcw(int ccw) {
+ fCcw = ccw;
+ }
+
void setGlobalState(SkOpGlobalState* state) {
fState = state;
}
@@ -315,6 +342,10 @@ public:
fOppXor = isOppXor;
}
+ void setReverse() {
+ fReverse = true;
+ }
+
void setXor(bool isXor) {
fXor = isXor;
}
@@ -347,6 +378,7 @@ public:
} while ((segment = segment->next()));
}
+ void toReversePath(SkPathWriter* path) const;
void toPath(SkPathWriter* path) const;
SkOpSegment* undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr);
@@ -356,11 +388,13 @@ private:
SkOpSegment* fTail;
SkOpContour* fNext;
SkPathOpsBounds fBounds;
+ int fCcw;
int fCount;
int fFirstSorted;
bool fDone; // set by find top segment
bool fTopsFound;
bool fOperand; // true for the second argument to a binary operator
+ bool fReverse; // true if contour should be reverse written to path (used only by fix winding)
bool fXor; // set if original path had even-odd fill
bool fOppXor; // set if opposite path had even-odd fill
SkDEBUGCODE(int fID);