Index: src/pathops/SkOpSegment.cpp |
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp |
index a52ef4ace1d07b2fac4e42d8672776f7ceb75b1f..99af13a04e3274210bf85cb9c435efbecaafc09e 100644 |
--- a/src/pathops/SkOpSegment.cpp |
+++ b/src/pathops/SkOpSegment.cpp |
@@ -50,7 +50,7 @@ SkOpAngle* SkOpSegment::activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr |
if (SkOpAngle* result = activeAngleOther(start, startPtr, endPtr, done)) { |
return result; |
} |
- return NULL; |
+ return nullptr; |
} |
SkOpAngle* SkOpSegment::activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
@@ -91,7 +91,7 @@ SkOpAngle* SkOpSegment::activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** sta |
SkASSERT(downSpan->done()); |
} |
} |
- return NULL; |
+ return nullptr; |
} |
SkOpAngle* SkOpSegment::activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
@@ -297,7 +297,7 @@ void SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, |
} |
SkOpPtT* SkOpSegment::addMissing(double t, SkOpSegment* opp, SkChunkAlloc* allocator) { |
- SkOpSpanBase* existing = NULL; |
+ SkOpSpanBase* existing = nullptr; |
SkOpSpanBase* test = &fHead; |
double testT; |
do { |
@@ -373,7 +373,7 @@ SkOpPtT* SkOpSegment::addT(double t, AllowAlias allowAlias, SkChunkAlloc* alloca |
SkASSERT(span != &fTail); |
} while ((span = span->upCast()->next())); |
SkASSERT(0); |
- return NULL; |
+ return nullptr; |
} |
// choose a solitary t and pt value; remove aliases; align the opposite ends |
@@ -519,7 +519,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
SkOpAngle::IncludeType includeType) { |
SkASSERT(includeType != SkOpAngle::kUnaryXor); |
SkOpAngle* firstAngle = this->spanToAngle(end, start); |
- if (NULL == firstAngle || NULL == firstAngle->next()) { |
+ if (nullptr == firstAngle || nullptr == firstAngle->next()) { |
return SK_NaN32; |
} |
// if all angles have a computed winding, |
@@ -528,7 +528,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
// there's nothing to do |
// if two orderable angles are adjacent, and both are next to orderable angles, |
// and one has winding computed, transfer to the other |
- SkOpAngle* baseAngle = NULL; |
+ SkOpAngle* baseAngle = nullptr; |
bool tryReverse = false; |
// look for counterclockwise transfers |
SkOpAngle* angle = firstAngle->previous(); |
@@ -541,7 +541,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
SkASSERT(prior->next() == angle); |
SkASSERT(angle->next() == next); |
if (prior->unorderable() || angle->unorderable() || next->unorderable()) { |
- baseAngle = NULL; |
+ baseAngle = nullptr; |
continue; |
} |
int testWinding = angle->starter()->windSum(); |
@@ -552,7 +552,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
} |
if (baseAngle) { |
ComputeOneSum(baseAngle, angle, includeType); |
- baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : NULL; |
+ baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : nullptr; |
} |
} while (next != firstAngle); |
if (baseAngle && SK_MinS32 == firstAngle->starter()->windSum()) { |
@@ -560,7 +560,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
tryReverse = true; |
} |
if (tryReverse) { |
- baseAngle = NULL; |
+ baseAngle = nullptr; |
SkOpAngle* prior = firstAngle; |
do { |
angle = prior; |
@@ -568,7 +568,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
SkASSERT(prior->next() == angle); |
next = angle->next(); |
if (prior->unorderable() || angle->unorderable() || next->unorderable()) { |
- baseAngle = NULL; |
+ baseAngle = nullptr; |
continue; |
} |
int testWinding = angle->starter()->windSum(); |
@@ -578,7 +578,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, |
} |
if (baseAngle) { |
ComputeOneSumReverse(baseAngle, angle, includeType); |
- baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : NULL; |
+ baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : nullptr; |
} |
} while (prior != firstAngle); |
} |
@@ -646,7 +646,7 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa |
#endif |
SkOpSpan* startSpan = start->starter(end); |
if (startSpan->done()) { |
- return NULL; |
+ return nullptr; |
} |
markDone(startSpan); |
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev(); |
@@ -663,13 +663,13 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa |
if (!sortable) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
SkOpAngle* angle = this->spanToAngle(end, start); |
if (angle->unorderable()) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
#if DEBUG_SORT |
SkDebugf("%s\n", __FUNCTION__); |
@@ -679,14 +679,14 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa |
if (sumMiWinding == SK_MinS32) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
int sumSuWinding = updateOppWinding(end, start); |
if (operand()) { |
SkTSwap<int>(sumMiWinding, sumSuWinding); |
} |
SkOpAngle* nextAngle = angle->next(); |
- const SkOpAngle* foundAngle = NULL; |
+ const SkOpAngle* foundAngle = nullptr; |
bool foundDone = false; |
// iterate through the angle, and compute everyone's winding |
SkOpSegment* nextSegment; |
@@ -724,7 +724,7 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa |
} while ((nextAngle = nextAngle->next()) != angle); |
start->segment()->markDone(start->starter(end)); |
if (!foundAngle) { |
- return NULL; |
+ return nullptr; |
} |
*nextStart = foundAngle->start(); |
*nextEnd = foundAngle->end(); |
@@ -751,7 +751,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase, |
#endif |
SkOpSpan* startSpan = start->starter(end); |
if (startSpan->done()) { |
- return NULL; |
+ return nullptr; |
} |
markDone(startSpan); |
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev(); |
@@ -768,13 +768,13 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase, |
if (!sortable) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
SkOpAngle* angle = this->spanToAngle(end, start); |
if (angle->unorderable()) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
#if DEBUG_SORT |
SkDebugf("%s\n", __FUNCTION__); |
@@ -782,7 +782,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase, |
#endif |
int sumWinding = updateWinding(end, start); |
SkOpAngle* nextAngle = angle->next(); |
- const SkOpAngle* foundAngle = NULL; |
+ const SkOpAngle* foundAngle = nullptr; |
bool foundDone = false; |
// iterate through the angle, and compute everyone's winding |
SkOpSegment* nextSegment; |
@@ -820,7 +820,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase, |
} while ((nextAngle = nextAngle->next()) != angle); |
start->segment()->markDone(start->starter(end)); |
if (!foundAngle) { |
- return NULL; |
+ return nullptr; |
} |
*nextStart = foundAngle->start(); |
*nextEnd = foundAngle->end(); |
@@ -847,7 +847,7 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n |
#endif |
SkOpSpan* startSpan = start->starter(end); |
if (startSpan->done()) { |
- return NULL; |
+ return nullptr; |
} |
markDone(startSpan); |
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev(); |
@@ -863,14 +863,14 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n |
if (!angle || angle->unorderable()) { |
*unsortable = true; |
markDone(start->starter(end)); |
- return NULL; |
+ return nullptr; |
} |
#if DEBUG_SORT |
SkDebugf("%s\n", __FUNCTION__); |
angle->debugLoop(); |
#endif |
SkOpAngle* nextAngle = angle->next(); |
- const SkOpAngle* foundAngle = NULL; |
+ const SkOpAngle* foundAngle = nullptr; |
bool foundDone = false; |
// iterate through the angle, and compute everyone's winding |
SkOpSegment* nextSegment; |
@@ -888,7 +888,7 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n |
} while (nextAngle != angle); |
start->segment()->markDone(start->starter(end)); |
if (!foundAngle) { |
- return NULL; |
+ return nullptr; |
} |
*nextStart = foundAngle->start(); |
*nextEnd = foundAngle->end(); |
@@ -906,7 +906,7 @@ SkOpGlobalState* SkOpSegment::globalState() const { |
void SkOpSegment::init(SkPoint pts[], SkScalar weight, SkOpContour* contour, SkPath::Verb verb) { |
fContour = contour; |
- fNext = NULL; |
+ fNext = nullptr; |
fOriginal[0] = pts[0]; |
fOriginal[1] = pts[SkPathOpsVerbToPoints(verb)]; |
fPts = pts; |
@@ -918,7 +918,7 @@ void SkOpSegment::init(SkPoint pts[], SkScalar weight, SkOpContour* contour, SkP |
fTopsFound = false; |
fVisited = false; |
SkOpSpan* zeroSpan = &fHead; |
- zeroSpan->init(this, NULL, 0, fPts[0]); |
+ zeroSpan->init(this, nullptr, 0, fPts[0]); |
SkOpSpanBase* oneSpan = &fTail; |
zeroSpan->setNext(oneSpan); |
oneSpan->initBase(this, zeroSpan, 1, fPts[SkPathOpsVerbToPoints(fVerb)]); |
@@ -955,7 +955,7 @@ SkOpSpanBase* SkOpSegment::markAndChaseDone(SkOpSpanBase* start, SkOpSpanBase* e |
int step = start->step(end); |
SkOpSpan* minSpan = start->starter(end); |
markDone(minSpan); |
- SkOpSpanBase* last = NULL; |
+ SkOpSpanBase* last = nullptr; |
SkOpSegment* other = this; |
while ((other = other->nextChase(&start, &step, &minSpan, &last))) { |
if (other->done()) { |
@@ -972,7 +972,7 @@ bool SkOpSegment::markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, in |
SkOpSpan* spanStart = start->starter(end); |
int step = start->step(end); |
bool success = markWinding(spanStart, winding); |
- SkOpSpanBase* last = NULL; |
+ SkOpSpanBase* last = nullptr; |
SkOpSegment* other = this; |
while ((other = other->nextChase(&start, &step, &spanStart, &last))) { |
if (spanStart->windSum() != SK_MinS32) { |
@@ -993,7 +993,7 @@ bool SkOpSegment::markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, |
SkOpSpan* spanStart = start->starter(end); |
int step = start->step(end); |
bool success = markWinding(spanStart, winding, oppWinding); |
- SkOpSpanBase* last = NULL; |
+ SkOpSpanBase* last = nullptr; |
SkOpSegment* other = this; |
while ((other = other->nextChase(&start, &step, &spanStart, &last))) { |
if (spanStart->windSum() != SK_MinS32) { |
@@ -1051,7 +1051,7 @@ SkOpSpanBase* SkOpSegment::markAngle(int maxWinding, int sumWinding, int oppMaxW |
if (oppMaxWinding != oppSumWinding && UseInnerWinding(oppMaxWinding, oppSumWinding)) { |
oppMaxWinding = oppSumWinding; |
} |
- SkOpSpanBase* last = NULL; |
+ SkOpSpanBase* last = nullptr; |
// caller doesn't require that this marks anything |
(void) markAndChaseWinding(angle->start(), angle->end(), maxWinding, oppMaxWinding, &last); |
#if DEBUG_WINDING |
@@ -1126,7 +1126,7 @@ static SkOpSegment* set_last(SkOpSpanBase** last, SkOpSpanBase* endSpan) { |
if (last) { |
*last = endSpan; |
} |
- return NULL; |
+ return nullptr; |
} |
SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpSpan** minPtr, |
@@ -1139,9 +1139,9 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS |
SkOpSpanBase* foundSpan; |
SkOpSpanBase* otherEnd; |
SkOpSegment* other; |
- if (angle == NULL) { |
+ if (angle == nullptr) { |
if (endSpan->t() != 0 && endSpan->t() != 1) { |
- return NULL; |
+ return nullptr; |
} |
SkOpPtT* otherPtT = endSpan->ptT()->next(); |
other = otherPtT->segment(); |
@@ -1153,8 +1153,8 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS |
return set_last(last, endSpan); |
} |
const SkOpAngle* next = angle->next(); |
- if (NULL == next) { |
- return NULL; |
+ if (nullptr == next) { |
+ return nullptr; |
} |
#if DEBUG_WINDING |
if (angle->debugSign() != next->debugSign() && !angle->segment()->contour()->isXor() |
@@ -1172,7 +1172,7 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS |
} |
SkASSERT(*startPtr); |
if (!otherEnd) { |
- return NULL; |
+ return nullptr; |
} |
// SkASSERT(otherEnd >= 0); |
SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast(); |
@@ -1212,7 +1212,7 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc |
if (this->done()) { |
return false; |
} |
- SkOpSpan* prior = NULL; |
+ SkOpSpan* prior = nullptr; |
SkOpSpanBase* spanBase = &fHead; |
do { |
SkOpPtT* ptT = spanBase->ptT(), * spanStopPtT = ptT; |
@@ -1244,9 +1244,9 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc |
if (spanBase->containsCoinEnd(opp)) { |
continue; |
} |
- SkOpPtT* priorPtT = NULL, * priorStopPtT; |
+ SkOpPtT* priorPtT = nullptr, * priorStopPtT; |
// find prior span containing opp segment |
- SkOpSegment* priorOpp = NULL; |
+ SkOpSegment* priorOpp = nullptr; |
SkOpSpan* priorTest = spanBase->prev(); |
while (!priorOpp && priorTest) { |
priorStopPtT = priorPtT = priorTest->ptT(); |
@@ -1293,7 +1293,7 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc |
SkTSwap(priorPtT, ptT); |
} |
} |
- } while ((spanBase = spanBase->final() ? NULL : spanBase->upCast()->next())); |
+ } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next())); |
clear_visited(&fHead); |
return false; |
} |
@@ -1339,7 +1339,7 @@ void SkOpSegment::moveMultiples() { |
} |
SkOpSpanBase* oppNext = oppSpan; |
SkOpSpanBase* oppLast = oppSpan; |
- while ((oppNext = oppNext->final() ? NULL : oppNext->upCast()->next())) { |
+ while ((oppNext = oppNext->final() ? nullptr : oppNext->upCast()->next())) { |
if (!roughly_equal(oppNext->t(), oppSpan->t())) { |
break; |
} |
@@ -1393,7 +1393,7 @@ void SkOpSegment::moveMultiples() { |
} while ((testPtT = testPtT->next()) != startPtT); |
checkNextSpan: |
; |
- } while ((test = test->final() ? NULL : test->upCast()->next())); |
+ } while ((test = test->final() ? nullptr : test->upCast()->next())); |
debugValidate(); |
} |
@@ -1416,7 +1416,7 @@ void SkOpSegment::moveNearby() { |
} |
do { // iterate through all spans associated with start |
SkOpPtT* startBase = spanS->ptT(); |
- next = test->final() ? NULL : test->upCast()->next(); |
+ next = test->final() ? nullptr : test->upCast()->next(); |
do { |
SkOpPtT* testBase = test->ptT(); |
do { |
@@ -1506,7 +1506,7 @@ void SkOpSegment::sortAngles() { |
SkOpSpanBase* span = &this->fHead; |
do { |
SkOpAngle* fromAngle = span->fromAngle(); |
- SkOpAngle* toAngle = span->final() ? NULL : span->upCast()->toAngle(); |
+ SkOpAngle* toAngle = span->final() ? nullptr : span->upCast()->toAngle(); |
if (!fromAngle && !toAngle) { |
continue; |
} |
@@ -1560,11 +1560,11 @@ void SkOpSegment::sortAngles() { |
} |
} while ((ptT = ptT->next()) != stopPtT); |
if (baseAngle->loopCount() == 1) { |
- span->setFromAngle(NULL); |
+ span->setFromAngle(nullptr); |
if (toAngle) { |
- span->upCast()->setToAngle(NULL); |
+ span->upCast()->setToAngle(nullptr); |
} |
- baseAngle = NULL; |
+ baseAngle = nullptr; |
} |
#if DEBUG_SORT |
SkASSERT(!baseAngle || baseAngle->loopCount() > 1); |