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/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp
index 0b8ef02..54f49b3 100644
--- a/samplecode/SamplePathText.cpp
+++ b/samplecode/SamplePathText.cpp
@@ -115,14 +115,14 @@
}
void PathText::Glyph::reset(SkRandom& rand, int w, int h) {
- int screensize = SkTMax(w, h);
+ int screensize = std::max(w, h);
const SkRect& bounds = fPath.getBounds();
SkScalar t;
fPosition = {rand.nextF() * w, rand.nextF() * h};
t = pow(rand.nextF(), 100);
fZoom = ((1 - t) * screensize / 50 + t * screensize / 3) /
- SkTMax(bounds.width(), bounds.height());
+ std::max(bounds.width(), bounds.height());
fSpin = rand.nextF() * 360;
fMidpt = {bounds.centerX(), bounds.centerY()};
}
@@ -143,7 +143,7 @@
}
void reset() override {
- const SkScalar screensize = static_cast<SkScalar>(SkTMax(this->width(), this->height()));
+ const SkScalar screensize = static_cast<SkScalar>(std::max(this->width(), this->height()));
this->INHERITED::reset();
for (auto& v : fVelocities) {
@@ -356,7 +356,7 @@
};
void WavyPathText::Waves::reset(SkRandom& rand, int w, int h) {
- const double pixelsPerMeter = 0.06 * SkTMax(w, h);
+ const double pixelsPerMeter = 0.06 * std::max(w, h);
const double medianWavelength = 8 * pixelsPerMeter;
const double medianWaveAmplitude = 0.05 * 4 * pixelsPerMeter;
const double gravity = 9.8 * pixelsPerMeter;