Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkColor_DEFINED | 8 #ifndef SkColor_DEFINED |
| 9 #define SkColor_DEFINED | 9 #define SkColor_DEFINED |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 hsv[2] is Value [0...1] | 132 hsv[2] is Value [0...1] |
| 133 If hsv values are out of range, they are pinned. | 133 If hsv values are out of range, they are pinned. |
| 134 @param hsv 3 element array which holds the input HSV components. | 134 @param hsv 3 element array which holds the input HSV components. |
| 135 @return the resulting argb color | 135 @return the resulting argb color |
| 136 */ | 136 */ |
| 137 static inline SkColor SkHSVToColor(const SkScalar hsv[3]) | 137 static inline SkColor SkHSVToColor(const SkScalar hsv[3]) |
| 138 { | 138 { |
| 139 return SkHSVToColor(0xFF, hsv); | 139 return SkHSVToColor(0xFF, hsv); |
| 140 } | 140 } |
| 141 | 141 |
| 142 static inline U8CPU SkUnitScalarClampToByte(SkScalar x) { | |
|
reed1
2015/09/11 18:49:50
Does this need to be public?
robertphillips
2015/09/15 16:35:06
Done. Moved to SkColorPriv.h.
| |
| 143 if (x < 0) { | |
| 144 return 0; | |
| 145 } | |
| 146 if (x >= SK_Scalar1) { | |
| 147 return 255; | |
| 148 } | |
| 149 return SkScalarToFixed(x) >> 8; | |
| 150 } | |
| 151 | |
| 142 //////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////// |
| 143 | 153 |
| 144 /** 32 bit ARGB color value, premultiplied. The byte order for this value is | 154 /** 32 bit ARGB color value, premultiplied. The byte order for this value is |
| 145 configuration dependent, matching the format of kARGB32 bitmaps. This is dif ferent | 155 configuration dependent, matching the format of kARGB32 bitmaps. This is dif ferent |
| 146 from SkColor, which is nonpremultiplied, and is always in the same byte orde r. | 156 from SkColor, which is nonpremultiplied, and is always in the same byte orde r. |
| 147 */ | 157 */ |
| 148 typedef uint32_t SkPMColor; | 158 typedef uint32_t SkPMColor; |
| 149 | 159 |
| 150 /** Return a SkPMColor value from unpremultiplied 8 bit component values | 160 /** Return a SkPMColor value from unpremultiplied 8 bit component values |
| 151 */ | 161 */ |
| 152 SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); | 162 SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); |
| 153 /** Return a SkPMColor value from a SkColor value. This is done by multiplying t he color | 163 /** Return a SkPMColor value from a SkColor value. This is done by multiplying t he color |
| 154 components by the color's alpha, and by arranging the bytes in a configurati on | 164 components by the color's alpha, and by arranging the bytes in a configurati on |
| 155 dependent order, to match the format of kARGB32 bitmaps. | 165 dependent order, to match the format of kARGB32 bitmaps. |
| 156 */ | 166 */ |
| 157 SK_API SkPMColor SkPreMultiplyColor(SkColor c); | 167 SK_API SkPMColor SkPreMultiplyColor(SkColor c); |
| 158 | 168 |
| 159 /** Define a function pointer type for combining two premultiplied colors | 169 /** Define a function pointer type for combining two premultiplied colors |
| 160 */ | 170 */ |
| 161 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); | 171 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); |
| 162 | 172 |
| 163 #endif | 173 #endif |
| OLD | NEW |