Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: include/core/SkColor.h

Issue 1311583005: Add special case circle blur for Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 SkUnitScalarToByte(SkScalar x) {
143 if (x < 0) {
144 return 0;
145 }
146 if (x >= SK_Scalar1) {
147 return 255;
148 }
149 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698