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

Unified Diff: include/core/SkColor.h

Issue 1617813002: experiment: float color components (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with colorshader 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
« no previous file with comments | « no previous file | include/core/SkColorFilter.h » ('j') | src/core/SkColor.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkColor.h
diff --git a/include/core/SkColor.h b/include/core/SkColor.h
index 1ba1331c1a7261f3faaba32002dc113ac9ed0397..3f0e9dcd1f50b994118cdeb23ba511c586620e6c 100644
--- a/include/core/SkColor.h
+++ b/include/core/SkColor.h
@@ -160,4 +160,34 @@ SK_API SkPMColor SkPreMultiplyColor(SkColor c);
*/
typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst);
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * The float values are 0...1 premultiplied
+ */
+struct SK_ATTRIBUTE(aligned(16)) SkPM4f {
+ float fVec[4];
+
+ float a() const { return fVec[SK_A32_SHIFT/8]; }
+};
+
+/*
+ * The float values are 0...1 unpremultiplied
+ */
+struct SkColor4f {
+ float fA;
+ float fR;
+ float fG;
+ float fB;
+
+ static SkColor4f Normalize(float a, float r, float g, float b);
+ static SkColor4f FromColor(SkColor);
+
+ SkColor4f normalize() const {
+ return Normalize(fA, fR, fG, fB);
+ }
+
+ SkPM4f premul() const;
+};
+
#endif
« no previous file with comments | « no previous file | include/core/SkColorFilter.h » ('j') | src/core/SkColor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698