Remove SkTMin and SkTMax
Use std::min and std::max everywhere.
SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.
Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/pathops/SkPathOpsCurve.cpp b/src/pathops/SkPathOpsCurve.cpp
index 734d599..cc77513 100644
--- a/src/pathops/SkPathOpsCurve.cpp
+++ b/src/pathops/SkPathOpsCurve.cpp
@@ -15,8 +15,8 @@
double minX = fCubic.fPts[0].fX;
double maxX = minX;
for (int index = 1; index <= count; ++index) {
- minX = SkTMin(minX, fCubic.fPts[index].fX);
- maxX = SkTMax(maxX, fCubic.fPts[index].fX);
+ minX = std::min(minX, fCubic.fPts[index].fX);
+ maxX = std::max(maxX, fCubic.fPts[index].fX);
}
if (!AlmostBetweenUlps(minX, xy.fX, maxX)) {
return -1;
@@ -24,8 +24,8 @@
double minY = fCubic.fPts[0].fY;
double maxY = minY;
for (int index = 1; index <= count; ++index) {
- minY = SkTMin(minY, fCubic.fPts[index].fY);
- maxY = SkTMax(maxY, fCubic.fPts[index].fY);
+ minY = std::min(minY, fCubic.fPts[index].fY);
+ maxY = std::max(maxY, fCubic.fPts[index].fY);
}
if (!AlmostBetweenUlps(minY, xy.fY, maxY)) {
return -1;
@@ -45,7 +45,7 @@
if (minIndex < 0) {
return -1;
}
- double largest = SkTMax(SkTMax(maxX, maxY), -SkTMin(minX, minY));
+ double largest = std::max(std::max(maxX, maxY), -std::min(minX, minY));
if (!AlmostEqualUlps_Pin(largest, largest + minDist)) { // is distance within ULPS tolerance?
return -1;
}
@@ -102,7 +102,7 @@
// central place for this val-is-small-compared-to-curve check
double maxVal = 0;
for (int index = 0; index <= SkPathOpsVerbToPoints(verb); ++index) {
- maxVal = SkTMax(maxVal, SkTMax(SkTAbs(fCurve[index].fX),
+ maxVal = std::max(maxVal, std::max(SkTAbs(fCurve[index].fX),
SkTAbs(fCurve[index].fY)));
}
{