Index: include/core/SkScalar.h |
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h |
index 3c1787ed2da5ead04788b16ba50cbb8e9116b127..fae23eb23a6c9a9b7862c215a41fb9f5ec4841d7 100644 |
--- a/include/core/SkScalar.h |
+++ b/include/core/SkScalar.h |
@@ -169,11 +169,15 @@ static inline int SkDScalarRoundToInt(SkScalar x) { |
} |
static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) { |
- return x < 0 ? 0 : x > max ? max : x; |
+ x = SkTMin(x, max); |
+ x = SkTMax<SkScalar>(x, 0); |
+ return x; |
} |
static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) { |
- return x < min ? min : x > max ? max : x; |
+ x = SkTMin(x, max); |
+ x = SkTMax(x, min); |
+ return x; |
} |
SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue); |