Index: include/core/SkColorPriv.h |
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h |
index bd0e040566cb0408c8ea5697d4e7c2c20781de43..40e6e15dc8873d823ff863f33196f852190b39b8 100644 |
--- a/include/core/SkColorPriv.h |
+++ b/include/core/SkColorPriv.h |
@@ -224,13 +224,7 @@ static inline int SkAlphaBlend255(S16CPU src, S16CPU dst, U8CPU alpha) { |
} |
static inline U8CPU SkUnitScalarClampToByte(SkScalar x) { |
- if (x < 0) { |
- return 0; |
- } |
- if (x >= SK_Scalar1) { |
- return 255; |
- } |
- return SkScalarToFixed(x) >> 8; |
+ return static_cast<U8CPU>(SkScalarPin(x, 0, 1) * 255 + 0.5); |
} |
#define SK_R16_BITS 5 |