Remove SkScalarClampMax and SkScalarPin
Change-Id: Ic96a0ea2cd1bfd59ee3f236543e1d6dd102544ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269142
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/GrDistanceFieldGenFromVector.cpp b/src/gpu/GrDistanceFieldGenFromVector.cpp
index 988f3b9..b91cb35 100644
--- a/src/gpu/GrDistanceFieldGenFromVector.cpp
+++ b/src/gpu/GrDistanceFieldGenFromVector.cpp
@@ -242,8 +242,8 @@
SkPoint t = _P1mP0 - fPts[2] + fPts[1];
t.fX = _P1mP0.fX / t.fX;
t.fY = _P1mP0.fY / t.fY;
- t.fX = SkScalarClampMax(t.fX, 1.0);
- t.fY = SkScalarClampMax(t.fY, 1.0);
+ t.fX = SkTPin(t.fX, 0.0f, 1.0f);
+ t.fY = SkTPin(t.fY, 0.0f, 1.0f);
t.fX = _P1mP0.fX * t.fX;
t.fY = _P1mP0.fY * t.fY;
const SkPoint m = fPts[0] + t;
@@ -695,7 +695,7 @@
// The distance field is constructed as unsigned char values, so that the zero value is at 128,
// Beside 128, we have 128 values in range [0, 128), but only 127 values in range (128, 255].
// So we multiply distanceMagnitude by 127/128 at the latter range to avoid overflow.
- dist = SkScalarPin(-dist, -distanceMagnitude, distanceMagnitude * 127.0f / 128.0f);
+ dist = SkTPin<float>(-dist, -distanceMagnitude, distanceMagnitude * 127.0f / 128.0f);
// Scale into the positive range for unsigned distance.
dist += distanceMagnitude;