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

Unified Diff: include/core/SkColor.h

Issue 1642703003: starter procs for blending with pm4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: int to float Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: include/core/SkColor.h
diff --git a/include/core/SkColor.h b/include/core/SkColor.h
index 3ebd18b7aaa89dfb650a55024e542d761fe324e1..099771af9890b478f4e5b4ccbe40c3567630ac28 100644
--- a/include/core/SkColor.h
+++ b/include/core/SkColor.h
@@ -110,8 +110,7 @@ SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]);
@param color the argb color to convert. Note: the alpha component is ignored.
@param hsv 3 element array which holds the resulting HSV components.
*/
-static inline void SkColorToHSV(SkColor color, SkScalar hsv[3])
-{
+static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) {
SkRGBToHSV(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color), hsv);
}
@@ -134,8 +133,7 @@ SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]);
@param hsv 3 element array which holds the input HSV components.
@return the resulting argb color
*/
-static inline SkColor SkHSVToColor(const SkScalar hsv[3])
-{
+static inline SkColor SkHSVToColor(const SkScalar hsv[3]) {
return SkHSVToColor(0xFF, hsv);
}
@@ -166,11 +164,19 @@ typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst);
* The float values are 0...1 premultiplied
*/
struct SkPM4f {
+ enum {
+ A = SK_A32_SHIFT/8,
+ R = SK_R32_SHIFT/8,
+ G = SK_G32_SHIFT/8,
+ B = SK_B32_SHIFT/8,
+ };
mtklein 2016/01/29 15:23:00 +1
float fVec[4];
- float a() const { return fVec[SK_A32_SHIFT/8]; }
+ float a() const { return fVec[3]; }
mtklein 2016/01/29 15:23:00 Ahem, fVec[A];
reed1 2016/01/29 22:35:27 Doh
static SkPM4f FromPMColor(SkPMColor);
+
+ bool isUnit() const;
};
/*

Powered by Google App Engine
This is Rietveld 408576698