Revert[2] of float color components
This reverts commit 2a2bdc698460c38ac9e24ba4abdeefec67bcba37.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1622483002
TBR=
NOTRY=True
Test-Ubuntu-GCC-ShuttleA-GPU-GTX660-x86_64-Release-Trybot seems wicked slow
Review URL: https://codereview.chromium.org/1622483002
diff --git a/include/core/SkColor.h b/include/core/SkColor.h
index 1ba1331..7794638 100644
--- a/include/core/SkColor.h
+++ b/include/core/SkColor.h
@@ -160,4 +160,44 @@
*/
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;
+
+ bool operator==(const SkColor4f& other) const {
+ return fA == other.fA && fR == other.fR && fG == other.fG && fB == other.fB;
+ }
+ bool operator!=(const SkColor4f& other) const {
+ return !(*this == other);
+ }
+
+ const float* vec() const { return &fA; }
+ float* vec() { return &fA; }
+
+ static SkColor4f Pin(float a, float r, float g, float b);
+ static SkColor4f FromColor(SkColor);
+
+ SkColor4f pin() const {
+ return Pin(fA, fR, fG, fB);
+ }
+
+ SkPM4f premul() const;
+};
+
#endif