Index: src/pathops/SkOpContour.h |
diff --git a/src/pathops/SkOpContour.h b/src/pathops/SkOpContour.h |
index b9f0b85af5dbe1ecfccf9eb1e2ca7b3730b73241..0db6eabdfe7f6229e9f7cf848ea0bb60a15b2deb 100644 |
--- a/src/pathops/SkOpContour.h |
+++ b/src/pathops/SkOpContour.h |
@@ -11,7 +11,6 @@ |
#include "SkTDArray.h" |
#include "SkTSort.h" |
-class SkChunkAlloc; |
enum class SkOpRayDir; |
struct SkOpRayHit; |
class SkPathWriter; |
@@ -30,47 +29,31 @@ public: |
bool operator<(const SkOpContour& rh) const { |
return fBounds.fTop == rh.fBounds.fTop |
- ? fBounds.fLeft < rh.fBounds.fLeft |
- : fBounds.fTop < rh.fBounds.fTop; |
+ ? fBounds.fLeft < rh.fBounds.fLeft |
+ : fBounds.fTop < rh.fBounds.fTop; |
} |
- void addAlignIntersections(SkOpContourHead* contourList, SkChunkAlloc* allocator) { |
- SkASSERT(fCount > 0); |
- SkOpSegment* segment = &fHead; |
- do { |
- segment->addAlignIntersections(contourList, allocator); |
- } while ((segment = segment->next())); |
- } |
- |
- void addConic(SkPoint pts[3], SkScalar weight, SkChunkAlloc* allocator) { |
- appendSegment(allocator).addConic(pts, weight, this); |
+ void addConic(SkPoint pts[3], SkScalar weight) { |
+ appendSegment().addConic(pts, weight, this); |
} |
- void addCubic(SkPoint pts[4], SkChunkAlloc* allocator) { |
- appendSegment(allocator).addCubic(pts, this); |
+ void addCubic(SkPoint pts[4]) { |
+ appendSegment().addCubic(pts, this); |
} |
- SkOpSegment* addCurve(SkPath::Verb verb, const SkPoint pts[4], SkChunkAlloc* allocator); |
+ SkOpSegment* addCurve(SkPath::Verb verb, const SkPoint pts[4]); |
- void addLine(SkPoint pts[2], SkChunkAlloc* allocator) { |
- appendSegment(allocator).addLine(pts, this); |
+ SkOpSegment* addLine(SkPoint pts[2]) { |
+ return appendSegment().addLine(pts, this); |
} |
- void addQuad(SkPoint pts[3], SkChunkAlloc* allocator) { |
- appendSegment(allocator).addQuad(pts, this); |
- } |
- |
- void align() { |
- SkASSERT(fCount > 0); |
- SkOpSegment* segment = &fHead; |
- do { |
- segment->align(); |
- } while ((segment = segment->next())); |
+ void addQuad(SkPoint pts[3]) { |
+ appendSegment().addQuad(pts, this); |
} |
- SkOpSegment& appendSegment(SkChunkAlloc* allocator) { |
+ SkOpSegment& appendSegment() { |
SkOpSegment* result = fCount++ |
- ? SkOpTAllocator<SkOpSegment>::Allocate(allocator) : &fHead; |
+ ? SkOpTAllocator<SkOpSegment>::Allocate(this->globalState()->allocator()) : &fHead; |
result->setPrev(fTail); |
if (fTail) { |
fTail->setNext(result); |
@@ -79,8 +62,8 @@ public: |
return *result; |
} |
- SkOpContour* appendContour(SkChunkAlloc* allocator) { |
- SkOpContour* contour = SkOpTAllocator<SkOpContour>::New(allocator); |
+ SkOpContour* appendContour() { |
+ SkOpContour* contour = SkOpTAllocator<SkOpContour>::New(this->globalState()->allocator()); |
contour->setNext(nullptr); |
SkOpContour* prev = this; |
SkOpContour* next; |
@@ -90,16 +73,16 @@ public: |
prev->setNext(contour); |
return contour; |
} |
- |
+ |
const SkPathOpsBounds& bounds() const { |
return fBounds; |
} |
- void calcAngles(SkChunkAlloc* allocator) { |
+ void calcAngles() { |
SkASSERT(fCount > 0); |
SkOpSegment* segment = &fHead; |
do { |
- segment->calcAngles(allocator); |
+ segment->calcAngles(); |
} while ((segment = segment->next())); |
} |
@@ -132,14 +115,21 @@ public: |
return SkDEBUGRELEASE(this->globalState()->debugAngle(id), nullptr); |
} |
+ const SkOpCoincidence* debugCoincidence() const { |
+ return this->globalState()->coincidence(); |
+ } |
+ |
+#if DEBUG_COINCIDENCE_VERBOSE |
void debugCheckHealth(const char* id, SkPathOpsDebug::GlitchLog* ) const; |
+#endif |
SkOpContour* debugContour(int id) { |
return SkDEBUGRELEASE(this->globalState()->debugContour(id), nullptr); |
} |
- void debugMissingCoincidence(const char* id, SkPathOpsDebug::GlitchLog* log, |
- const SkOpCoincidence* coincidence) const; |
+#if DEBUG_COINCIDENCE_VERBOSE |
+ void debugMissingCoincidence(const char* id, SkPathOpsDebug::GlitchLog* log) const; |
+#endif |
const SkOpPtT* debugPtT(int id) const { |
return SkDEBUGRELEASE(this->globalState()->debugPtT(id), nullptr); |
@@ -154,7 +144,7 @@ public: |
} |
SkOpGlobalState* globalState() const { |
- return fState; |
+ return fState; |
} |
void debugValidate() const { |
@@ -197,15 +187,6 @@ public: |
return fTail->pts()[SkPathOpsVerbToPoints(fTail->verb())]; |
} |
- bool findCollapsed() { |
- SkASSERT(fCount > 0); |
- SkOpSegment* segment = &fHead; |
- do { |
- segment->findCollapsed(); |
- } while ((segment = segment->next())); |
- return true; |
- } |
- |
SkOpSpan* findSortableTop(SkOpContour* ); |
SkOpSegment* first() { |
@@ -237,14 +218,15 @@ public: |
return fXor; |
} |
- void markDone() { |
+ void markAllDone() { |
SkOpSegment* segment = &fHead; |
do { |
segment->markAllDone(); |
} while ((segment = segment->next())); |
} |
- bool missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocator) { |
+ // Please keep this aligned with debugMissingCoincidence() |
+ bool missingCoincidence() { |
SkASSERT(fCount > 0); |
SkOpSegment* segment = &fHead; |
bool result = false; |
@@ -253,7 +235,7 @@ public: |
#if DEBUG_ANGLE |
segment->debugCheckAngleCoin(); |
#endif |
- } else if (segment->missingCoincidence(coincidences, allocator)) { |
+ } else if (segment->missingCoincidence()) { |
result = true; |
// FIXME: trying again loops forever in issue3651_6 |
// The continue below is speculative -- once there's an actual case that requires it, |