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/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp
index e094978..8f7969b 100644
--- a/tests/PathOpsLineIntersectionTest.cpp
+++ b/tests/PathOpsLineIntersectionTest.cpp
@@ -118,29 +118,29 @@
return;
}
if (line1[0].fY == line1[1].fY) {
- double left = SkTMin(line1[0].fX, line1[1].fX);
- double right = SkTMax(line1[0].fX, line1[1].fX);
+ double left = std::min(line1[0].fX, line1[1].fX);
+ double right = std::max(line1[0].fX, line1[1].fX);
SkIntersections ts;
ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left);
check_results(reporter, line2, line1, ts, nearAllowed);
}
if (line2[0].fY == line2[1].fY) {
- double left = SkTMin(line2[0].fX, line2[1].fX);
- double right = SkTMax(line2[0].fX, line2[1].fX);
+ double left = std::min(line2[0].fX, line2[1].fX);
+ double right = std::max(line2[0].fX, line2[1].fX);
SkIntersections ts;
ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left);
check_results(reporter, line1, line2, ts, nearAllowed);
}
if (line1[0].fX == line1[1].fX) {
- double top = SkTMin(line1[0].fY, line1[1].fY);
- double bottom = SkTMax(line1[0].fY, line1[1].fY);
+ double top = std::min(line1[0].fY, line1[1].fY);
+ double bottom = std::max(line1[0].fY, line1[1].fY);
SkIntersections ts;
ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top);
check_results(reporter, line2, line1, ts, nearAllowed);
}
if (line2[0].fX == line2[1].fX) {
- double top = SkTMin(line2[0].fY, line2[1].fY);
- double bottom = SkTMax(line2[0].fY, line2[1].fY);
+ double top = std::min(line2[0].fY, line2[1].fY);
+ double bottom = std::max(line2[0].fY, line2[1].fY);
SkIntersections ts;
ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
check_results(reporter, line1, line2, ts, nearAllowed);
@@ -161,8 +161,8 @@
return;
}
if (line1[0].fY == line1[1].fY) {
- double left = SkTMin(line1[0].fX, line1[1].fX);
- double right = SkTMax(line1[0].fX, line1[1].fX);
+ double left = std::min(line1[0].fX, line1[1].fX);
+ double right = std::max(line1[0].fX, line1[1].fX);
SkIntersections ts;
ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left);
REPORTER_ASSERT(reporter, pts == 2);
@@ -170,8 +170,8 @@
check_results(reporter, line2, line1, ts, false);
}
if (line2[0].fY == line2[1].fY) {
- double left = SkTMin(line2[0].fX, line2[1].fX);
- double right = SkTMax(line2[0].fX, line2[1].fX);
+ double left = std::min(line2[0].fX, line2[1].fX);
+ double right = std::max(line2[0].fX, line2[1].fX);
SkIntersections ts;
ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left);
REPORTER_ASSERT(reporter, pts == 2);
@@ -179,8 +179,8 @@
check_results(reporter, line1, line2, ts, false);
}
if (line1[0].fX == line1[1].fX) {
- double top = SkTMin(line1[0].fY, line1[1].fY);
- double bottom = SkTMax(line1[0].fY, line1[1].fY);
+ double top = std::min(line1[0].fY, line1[1].fY);
+ double bottom = std::max(line1[0].fY, line1[1].fY);
SkIntersections ts;
ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top);
REPORTER_ASSERT(reporter, pts == 2);
@@ -188,8 +188,8 @@
check_results(reporter, line2, line1, ts, false);
}
if (line2[0].fX == line2[1].fX) {
- double top = SkTMin(line2[0].fY, line2[1].fY);
- double bottom = SkTMax(line2[0].fY, line2[1].fY);
+ double top = std::min(line2[0].fY, line2[1].fY);
+ double bottom = std::max(line2[0].fY, line2[1].fY);
SkIntersections ts;
ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
REPORTER_ASSERT(reporter, pts == 2);