Chromium Code Reviews| Index: include/core/SkColor.h |
| diff --git a/include/core/SkColor.h b/include/core/SkColor.h |
| index 1ba1331c1a7261f3faaba32002dc113ac9ed0397..441f47a6e301d84ad9b1644ad5dc4cd264cb349d 100644 |
| --- a/include/core/SkColor.h |
| +++ b/include/core/SkColor.h |
| @@ -139,6 +139,16 @@ static inline SkColor SkHSVToColor(const SkScalar hsv[3]) |
| return SkHSVToColor(0xFF, hsv); |
| } |
| +static inline U8CPU SkUnitScalarToByte(SkScalar x) { |
| + if (x < 0) { |
| + return 0; |
| + } |
| + if (x >= SK_Scalar1) { |
| + return 255; |
| + } |
| + return SkScalarToFixed(x) >> 8; |
|
bsalomon
2015/09/11 13:05:46
Maybe SkUnitScalarClampToByte(). Many of our SkXTo
robertphillips
2015/09/11 15:55:34
Done.
reed1
2015/09/11 18:47:11
Independent of the clamping question...
This is a
robertphillips
2015/09/15 16:35:06
It seems like some pinned version of #2 would be b
|
| +} |
| + |
| //////////////////////////////////////////////////////////////////////// |
| /** 32 bit ARGB color value, premultiplied. The byte order for this value is |