Use SkTPin instead of std::clamp

std::clamp is c++17 so using it causes some builds to fail.

Change-Id: I3e90ffc081e1f18ebab1c4f403826e94e58bf07d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299878
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
Chris Dalton 2020-06-30 10:36:28 -06:00 committed by Skia Commit-Bot
parent 1c62a7b034
commit 2d7cf46c81

View File

@ -155,7 +155,7 @@ void GrStrokeGeometry::quadraticTo(Verb leftJoinVerb, const SkPoint P[3], float
// Decide how many flat line segments to chop the curve into.
int numSegments = wangs_formula_quadratic(p0, p1, p2);
numSegments = std::clamp(numSegments, 1, 1 << kMaxNumLinearSegmentsLog2);
numSegments = SkTPin(numSegments, 1, 1 << kMaxNumLinearSegmentsLog2);
// At + B gives a vector tangent to the quadratic.
Sk2f A = p0 - p1*2 + p2;
@ -284,7 +284,7 @@ void GrStrokeGeometry::cubicTo(Verb leftJoinVerb, const SkPoint P[4], float maxC
// Decide how many flat line segments to chop the curve into.
int numSegments = wangs_formula_cubic(p0, p1, p2, p3);
numSegments = std::clamp(numSegments, 1, 1 << kMaxNumLinearSegmentsLog2);
numSegments = SkTPin(numSegments, 1, 1 << kMaxNumLinearSegmentsLog2);
// At^2 + Bt + C gives a vector tangent to the cubic. (More specifically, it's the derivative
// minus an irrelevant scale by 3, since all we care about is the direction.)