Stop using SkTSwap.
Use std::swap instead. It does not appear that any external user
specializes SkTSwap, but some may still use it. This removes all use in
Skia so that SkTSwap can later be removed in a smaller CL. After that
the <utility> include can be removed from SkTypes.h.
Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753
Reviewed-on: https://skia-review.googlesource.com/135578
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index 346db4b..a88f413 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -13,6 +13,8 @@
#include "SkPathOpsDebug.h"
#include "SkString.h"
+#include <utility>
+
#if DEBUG_DUMP_VERIFY
bool SkPathOpsDebug::gDumpOp; // set to true to write op to file before a crash
bool SkPathOpsDebug::gVerifyOp; // set to true to compare result against regions
@@ -923,8 +925,9 @@
const SkOpPtT* oppEnd = spanBase->ptT();
bool swapped = priorPtT->fT > ptT->fT;
if (swapped) {
- SkTSwap(priorPtT, ptT);
- SkTSwap(oppStart, oppEnd);
+ using std::swap;
+ swap(priorPtT, ptT);
+ swap(oppStart, oppEnd);
}
const SkOpCoincidence* coincidence = this->globalState()->coincidence();
const SkOpPtT* rootPriorPtT = priorPtT->span()->ptT();
@@ -951,7 +954,8 @@
}
swapBack:
if (swapped) {
- SkTSwap(priorPtT, ptT);
+ using std::swap;
+ swap(priorPtT, ptT);
}
}
} while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next()));
@@ -1531,15 +1535,17 @@
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->debugAddOrOverlap(log, coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, &added), false) {
@@ -1743,11 +1749,11 @@
return log->record(SkPathOpsDebug::kAddIfCollapsed_Glitch, oppSeg);
}
if (coinTs > coinTe) {
- SkTSwap(coinTs, coinTe);
- SkTSwap(oppTs, oppTe);
+ using std::swap;
+ swap(coinTs, coinTe);
+ swap(oppTs, oppTe);
}
- return this->debugAddOrOverlap(log, coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, added
- );
+ return this->debugAddOrOverlap(log, coinSeg, oppSeg, coinTs, coinTe, oppTs, oppTe, added);
}
/* Commented-out lines keep this in sync addOrOverlap() */
@@ -1848,8 +1854,9 @@
log->record(SkPathOpsDebug::kAddMissingExtend_Glitch, coinSeg, coinTs, coinTe, oppSeg, oppTs, oppTe);
} else {
if (oppTs > oppTe) {
- SkTSwap(coinTs, coinTe);
- SkTSwap(oppTs, oppTe);
+ using std::swap;
+ swap(coinTs, coinTe);
+ swap(oppTs, oppTe);
}
log->record(SkPathOpsDebug::kAddMissingExtend_Glitch, oppSeg, oppTs, oppTe, coinSeg, coinTs, coinTe);
}
@@ -2052,7 +2059,8 @@
// SkASSERT(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 */
@@ -2130,7 +2138,8 @@
SkASSERT(next != end);
SkASSERT(!next->contains(end) || log);
if (next->t() > end->t()) {
- SkTSwap(next, end);
+ using std::swap;
+ swap(next, end);
}
do {
const SkOpPtT* ptT = next->ptT();
@@ -2187,7 +2196,8 @@
SkASSERT(between(0, toe, 1));
SkASSERT(tos != toe);
if (tos > toe) {
- SkTSwap(tos, toe);
+ using std::swap;
+ swap(tos, toe);
}
do {
double lcs, lce, los, loe;
@@ -2200,7 +2210,8 @@
los = list->oppPtTStart()->fT;
loe = list->oppPtTEnd()->fT;
if (los > loe) {
- SkTSwap(los, loe);
+ using std::swap;
+ swap(los, loe);
}
} else if (coinSeg == list->oppPtTStart()->segment()) {
if (oppSeg != list->coinPtTStart()->segment()) {
@@ -2209,7 +2220,8 @@
lcs = list->oppPtTStart()->fT;
lce = list->oppPtTEnd()->fT;
if (lcs > lce) {
- SkTSwap(lcs, lce);
+ using std::swap;
+ swap(lcs, lce);
}
los = list->coinPtTStart()->fT;
loe = list->coinPtTEnd()->fT;