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

Unified Diff: src/pathops/SkPathOpsPostSect.cpp

Issue 1037573004: cumulative pathops patch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix pathopsinverse gm Created 5 years, 9 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/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsQuad.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsPostSect.cpp
diff --git a/src/pathops/SkPathOpsPostSect.cpp b/src/pathops/SkPathOpsPostSect.cpp
old mode 100644
new mode 100755
index 15a1900ce3b1ad48a8a62768d5564379873cda51..eb2d1ab3ab1c98f63b5bc1c24bf6c01de590169a
--- a/src/pathops/SkPathOpsPostSect.cpp
+++ b/src/pathops/SkPathOpsPostSect.cpp
@@ -17,8 +17,8 @@ SkOpContour* SkOpPtT::contour() const {
return segment()->contour();
}
-SkOpDebugState* SkOpPtT::debugState() const {
- return PATH_OPS_DEBUG_RELEASE(contour()->debugState(), NULL);
+SkOpGlobalState* SkOpPtT::globalState() const {
+ return PATH_OPS_DEBUG_RELEASE(contour()->globalState(), NULL);
}
void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplicate) {
@@ -28,7 +28,7 @@ void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplica
fNext = this;
fDuplicatePt = duplicate;
fDeleted = false;
- PATH_OPS_DEBUG_CODE(fID = ++span->debugState()->fPtTID);
+ PATH_OPS_DEBUG_CODE(fID = ++span->globalState()->fPtTID);
}
bool SkOpPtT::onEnd() const {
@@ -45,7 +45,7 @@ SkOpPtT* SkOpPtT::remove() {
do {
SkOpPtT* next = prev->fNext;
if (next == this) {
- prev->removeNext();
+ prev->removeNext(this);
fDeleted = true;
return prev;
}
@@ -55,14 +55,14 @@ SkOpPtT* SkOpPtT::remove() {
return NULL;
}
-void SkOpPtT::removeNext() {
+void SkOpPtT::removeNext(SkOpPtT* kept) {
SkASSERT(this->fNext);
SkOpPtT* next = this->fNext;
this->fNext = next->fNext;
SkOpSpanBase* span = next->span();
next->setDeleted();
if (span->ptT() == next) {
- span->upCast()->detach();
+ span->upCast()->detach(kept);
}
}
@@ -199,7 +199,7 @@ void SkOpSpanBase::alignInner() {
// omit aliases that alignment makes redundant
if ((!ptT->alias() || test->alias()) && (ptT->onEnd() || !test->onEnd())) {
SkASSERT(test->alias());
- prev->removeNext();
+ prev->removeNext(ptT);
test = prev;
} else {
SkASSERT(ptT->alias());
@@ -239,8 +239,8 @@ SkOpContour* SkOpSpanBase::contour() const {
return segment()->contour();
}
-SkOpDebugState* SkOpSpanBase::debugState() const {
- return PATH_OPS_DEBUG_RELEASE(contour()->debugState(), NULL);
+SkOpGlobalState* SkOpSpanBase::globalState() const {
+ return PATH_OPS_DEBUG_RELEASE(contour()->globalState(), NULL);
}
void SkOpSpanBase::initBase(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoint& pt) {
@@ -252,7 +252,7 @@ void SkOpSpanBase::initBase(SkOpSegment* segment, SkOpSpan* prev, double t, cons
fAligned = true;
fChased = false;
PATH_OPS_DEBUG_CODE(fCount = 1);
- PATH_OPS_DEBUG_CODE(fID = ++debugState()->fSpanID);
+ PATH_OPS_DEBUG_CODE(fID = ++globalState()->fSpanID);
}
// this pair of spans share a common t value or point; merge them and eliminate duplicates
@@ -261,7 +261,7 @@ void SkOpSpanBase::merge(SkOpSpan* span) {
SkOpPtT* spanPtT = span->ptT();
SkASSERT(this->t() != spanPtT->fT);
SkASSERT(!zero_or_one(spanPtT->fT));
- span->detach();
+ span->detach(this->ptT());
SkOpPtT* remainder = spanPtT->next();
ptT()->insert(spanPtT);
while (remainder != spanPtT) {
@@ -304,7 +304,7 @@ bool SkOpSpan::containsCoincidence(const SkOpSegment* segment) const {
return false;
}
-void SkOpSpan::detach() {
+void SkOpSpan::detach(SkOpPtT* kept) {
SkASSERT(!final());
SkOpSpan* prev = this->prev();
SkASSERT(prev);
@@ -313,6 +313,9 @@ void SkOpSpan::detach() {
prev->setNext(next);
next->setPrev(prev);
this->segment()->detach(this);
+ if (this->coincident()) {
+ this->globalState()->fCoincidence->fixUp(this->ptT(), kept);
+ }
this->ptT()->setDeleted();
}
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsQuad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698