Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: src/pathops/SkOpContour.h

Issue 2321973005: Rewriting path writer (Closed)
Patch Set: revert unneeded test changes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkOpBuilder.cpp ('k') | src/pathops/SkOpContour.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpContour.h
diff --git a/src/pathops/SkOpContour.h b/src/pathops/SkOpContour.h
index 412fecd73f7f66953748693c35b23d713acf8d49..acc6744f2aea8c6694988f34bc85505c3c1bf695 100644
--- a/src/pathops/SkOpContour.h
+++ b/src/pathops/SkOpContour.h
@@ -63,18 +63,6 @@ public:
return *result;
}
- SkOpContour* appendContour() {
- SkOpContour* contour = SkOpTAllocator<SkOpContour>::New(this->globalState()->allocator());
- contour->setNext(nullptr);
- SkOpContour* prev = this;
- SkOpContour* next;
- while ((next = prev->next())) {
- prev = next;
- }
- prev->setNext(contour);
- return contour;
- }
-
const SkPathOpsBounds& bounds() const {
return fBounds;
}
@@ -219,6 +207,15 @@ public:
return fXor;
}
+ void joinSegments() {
+ SkOpSegment* segment = &fHead;
+ SkOpSegment* next;
+ do {
+ next = segment->next();
+ segment->joinEnds(next ? next : &fHead);
+ } while ((segment = next));
+ }
+
void markAllDone() {
SkOpSegment* segment = &fHead;
do {
@@ -289,22 +286,6 @@ public:
void rayCheck(const SkOpRayHit& base, SkOpRayDir dir, SkOpRayHit** hits, SkChunkAlloc* );
- void remove(SkOpContour* contour) {
- if (contour == this) {
- SkASSERT(fCount == 0);
- return;
- }
- SkASSERT(contour->fNext == nullptr);
- SkOpContour* prev = this;
- SkOpContour* next;
- while ((next = prev->next()) != contour) {
- SkASSERT(next);
- prev = next;
- }
- SkASSERT(prev);
- prev->setNext(nullptr);
- }
-
void reset() {
fTail = nullptr;
fNext = nullptr;
@@ -416,6 +397,42 @@ private:
};
class SkOpContourHead : public SkOpContour {
+public:
+ SkOpContour* appendContour() {
+ SkOpContour* contour = SkOpTAllocator<SkOpContour>::New(this->globalState()->allocator());
+ contour->setNext(nullptr);
+ SkOpContour* prev = this;
+ SkOpContour* next;
+ while ((next = prev->next())) {
+ prev = next;
+ }
+ prev->setNext(contour);
+ return contour;
+ }
+
+ void joinAllSegments() {
+ SkOpContour* next = this;
+ do {
+ next->joinSegments();
+ } while ((next = next->next()));
+ }
+
+ void remove(SkOpContour* contour) {
+ if (contour == this) {
+ SkASSERT(this->count() == 0);
+ return;
+ }
+ SkASSERT(contour->next() == nullptr);
+ SkOpContour* prev = this;
+ SkOpContour* next;
+ while ((next = prev->next()) != contour) {
+ SkASSERT(next);
+ prev = next;
+ }
+ SkASSERT(prev);
+ prev->setNext(nullptr);
+ }
+
};
#endif
« no previous file with comments | « src/pathops/SkOpBuilder.cpp ('k') | src/pathops/SkOpContour.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698