Chromium Code Reviews| Index: include/core/SkColorPriv.h |
| diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h |
| index bd0e040566cb0408c8ea5697d4e7c2c20781de43..23e82866824ae5e9e393340c740e5bfe829455ba 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); |
|
reed1
2016/02/22 18:09:32
In nearly all of our new Sk4f code, we do the foll
|
| } |
| #define SK_R16_BITS 5 |