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/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 451a155..df70034 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -10,6 +10,8 @@
#include "SkPathWriter.h"
#include "SkPointPriv.h"
+#include <utility>
+
/*
After computing raw intersections, post process all segments to:
- find small collections of points that can be collapsed to a single point
@@ -112,7 +114,8 @@
SkASSERT(abs(sumSuWinding) <= DEBUG_LIMIT_WIND_SUM);
#endif
if (this->operand()) {
- SkTSwap<int>(sumMiWinding, sumSuWinding);
+ using std::swap;
+ swap(sumMiWinding, sumSuWinding);
}
return this->activeOp(xorMiMask, xorSuMask, start, end, op, &sumMiWinding, &sumSuWinding);
}
@@ -343,7 +346,8 @@
if (binary) {
sumSuWinding = baseSegment->updateOppWindingReverse(baseAngle);
if (baseSegment->operand()) {
- SkTSwap<int>(sumMiWinding, sumSuWinding);
+ using std::swap;
+ swap(sumMiWinding, sumSuWinding);
}
}
SkOpSegment* nextSegment = nextAngle->segment();
@@ -372,7 +376,8 @@
if (binary) {
sumSuWinding = baseSegment->updateOppWinding(baseAngle);
if (baseSegment->operand()) {
- SkTSwap<int>(sumMiWinding, sumSuWinding);
+ using std::swap;
+ swap(sumMiWinding, sumSuWinding);
}
}
SkOpSegment* nextSegment = nextAngle->segment();
@@ -569,7 +574,8 @@
}
int sumSuWinding = updateOppWinding(end, start);
if (operand()) {
- SkTSwap<int>(sumMiWinding, sumSuWinding);
+ using std::swap;
+ swap(sumMiWinding, sumSuWinding);
}
SkOpAngle* nextAngle = angle->next();
const SkOpAngle* foundAngle = nullptr;
@@ -1170,8 +1176,9 @@
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);
}
SkOpCoincidence* coincidences = this->globalState()->coincidence();
SkOpPtT* rootPriorPtT = priorPtT->span()->ptT();
@@ -1198,7 +1205,8 @@
}
swapBack:
if (swapped) {
- SkTSwap(priorPtT, ptT);
+ using std::swap;
+ swap(priorPtT, ptT);
}
}
} while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next()));