diff options
Diffstat (limited to 'src/pathops/SkOpCoincidence.cpp')
-rw-r--r-- | src/pathops/SkOpCoincidence.cpp | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp index 93d0e403ff..a25a67e168 100644 --- a/src/pathops/SkOpCoincidence.cpp +++ b/src/pathops/SkOpCoincidence.cpp @@ -8,6 +8,8 @@ #include "SkOpSegment.h" #include "SkPathOpsTSect.h" +#include <utility> + // returns true if coincident span's start and end are the same bool SkCoincidentSpans::collapsed(const SkOpPtT* test) const { return (fCoinPtTStart == test && fCoinPtTEnd->contains(test)) @@ -120,7 +122,8 @@ void SkCoincidentSpans::set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart // returns true if both points are inside this bool SkCoincidentSpans::contains(const SkOpPtT* s, const SkOpPtT* e) const { if (s->fT > e->fT) { - SkTSwap(s, e); + using std::swap; + swap(s, e); } if (s->segment() == fCoinPtTStart->segment()) { return fCoinPtTStart->fT <= s->fT && e->fT <= fCoinPtTEnd->fT; @@ -129,7 +132,8 @@ bool SkCoincidentSpans::contains(const SkOpPtT* s, const SkOpPtT* e) const { double oppTs = fOppPtTStart->fT; double oppTe = fOppPtTEnd->fT; if (oppTs > oppTe) { - SkTSwap(oppTs, oppTe); + using std::swap; + swap(oppTs, oppTe); } return oppTs <= s->fT && e->fT <= oppTe; } @@ -193,12 +197,13 @@ bool SkOpCoincidence::extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtT const SkOpSegment* coinSeg = coinPtTStart->segment(); const SkOpSegment* oppSeg = oppPtTStart->segment(); if (!Ordered(coinPtTStart, oppPtTStart)) { - SkTSwap(coinSeg, oppSeg); - SkTSwap(coinPtTStart, oppPtTStart); - SkTSwap(coinPtTEnd, oppPtTEnd); + using std::swap; + swap(coinSeg, oppSeg); + swap(coinPtTStart, oppPtTStart); + swap(coinPtTEnd, oppPtTEnd); if (coinPtTStart->fT > coinPtTEnd->fT) { - SkTSwap(coinPtTStart, coinPtTEnd); - SkTSwap(oppPtTStart, oppPtTEnd); + swap(coinPtTStart, coinPtTEnd); + swap(oppPtTStart, oppPtTEnd); } } double oppMinT = SkTMin(oppPtTStart->fT, oppPtTEnd->fT); @@ -329,15 +334,17 @@ bool SkOpCoincidence::addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* oppTs = oppStart->fT; oppTe = testPtT->fT; } else { - SkTSwap(coinSeg, oppSeg); + using std::swap; + swap(coinSeg, oppSeg); coinTs = oppStart->fT; coinTe = testPtT->fT; oppTs = base->t(); oppTe = testSpan->t(); } if (coinTs > coinTe) { - SkTSwap(coinTs, coinTe); - SkTSwap(oppTs, oppTe); + using std::swap; + swap(coinTs, coinTe); + swap(oppTs, oppTe); } bool added; if (!this->addOrOverlap(coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, &added)) { @@ -573,7 +580,8 @@ bool SkOpCoincidence::checkOverlap(SkCoincidentSpans* check, } bool swapOpp = oppTs > oppTe; if (swapOpp) { - SkTSwap(oppTs, oppTe); + using std::swap; + swap(oppTs, oppTe); } do { if (check->coinPtTStart()->segment() != coinSeg) { @@ -591,7 +599,8 @@ bool SkOpCoincidence::checkOverlap(SkCoincidentSpans* check, if (oCheckTs <= oCheckTe) { return false; } - SkTSwap(oCheckTs, oCheckTe); + using std::swap; + swap(oCheckTs, oCheckTe); } bool oppOutside = oppTe < oCheckTs || oppTs > oCheckTe; if (coinOutside && oppOutside) { @@ -637,8 +646,9 @@ bool SkOpCoincidence::addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over2s, return true; } if (coinTs > coinTe) { - SkTSwap(coinTs, coinTe); - SkTSwap(oppTs, oppTe); + using std::swap; + swap(coinTs, coinTe); + swap(oppTs, oppTe); } return this->addOrOverlap(coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, added); } @@ -747,8 +757,9 @@ bool SkOpCoincidence::addOrOverlap(SkOpSegment* coinSeg, SkOpSegment* oppSeg, result = overlap->extend(cs, ce, os, oe); } else { if (os->fT > oe->fT) { - SkTSwap(cs, ce); - SkTSwap(os, oe); + using std::swap; + swap(cs, ce); + swap(os, oe); } result = overlap->extend(os, oe, cs, ce); } @@ -903,8 +914,9 @@ bool SkOpCoincidence::addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg return true; } if (s1->fT > e1->fT) { - SkTSwap(s1, e1); - SkTSwap(s2, e2); + using std::swap; + swap(s1, e1); + swap(s2, e2); } this->add(s1, e1, s2, e2); return true; @@ -947,12 +959,13 @@ bool SkOpCoincidence::contains(const SkOpPtT* coinPtTStart, const SkOpPtT* coinP const SkOpSegment* coinSeg = coinPtTStart->segment(); const SkOpSegment* oppSeg = oppPtTStart->segment(); if (!Ordered(coinPtTStart, oppPtTStart)) { - SkTSwap(coinSeg, oppSeg); - SkTSwap(coinPtTStart, oppPtTStart); - SkTSwap(coinPtTEnd, oppPtTEnd); + using std::swap; + swap(coinSeg, oppSeg); + swap(coinPtTStart, oppPtTStart); + swap(coinPtTEnd, oppPtTEnd); if (coinPtTStart->fT > coinPtTEnd->fT) { - SkTSwap(coinPtTStart, coinPtTEnd); - SkTSwap(oppPtTStart, oppPtTEnd); + swap(coinPtTStart, coinPtTEnd); + swap(oppPtTStart, oppPtTEnd); } } double oppMinT = SkTMin(oppPtTStart->fT, oppPtTEnd->fT); @@ -1054,7 +1067,8 @@ bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) { } if (addToStart) { if (operandSwap) { - SkTSwap(oWindValue, oOppValue); + using std::swap; + swap(oWindValue, oOppValue); } if (flipped) { windValue -= oWindValue; @@ -1072,7 +1086,8 @@ bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) { oWindValue = oOppValue = 0; } else { if (operandSwap) { - SkTSwap(windValue, oppValue); + using std::swap; + swap(windValue, oppValue); } if (flipped) { oWindValue -= windValue; @@ -1327,7 +1342,8 @@ bool SkOpCoincidence::mark(DEBUG_COIN_DECLARE_ONLY_PARAMS()) { FAIL_IF(oEnd->deleted()); bool flipped = coin->flipped(); if (flipped) { - SkTSwap(oStart, oEnd); + using std::swap; + swap(oStart, oEnd); } /* coin and opp spans may not match up. Mark the ends, and then let the interior get marked as many times as the spans allow */ |