Index: src/core/SkPMFloat.h |
diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h |
index d2d83d0068c1dc78b25c23c35115dd7ae05b2099..7c093a6a49ff60b2b973c0f658dedd134ebba7be 100644 |
--- a/src/core/SkPMFloat.h |
+++ b/src/core/SkPMFloat.h |
@@ -3,11 +3,21 @@ |
#include "SkTypes.h" |
#include "SkColor.h" |
+#include "Sk4x.h" |
// A pre-multiplied color in the same order as SkPMColor storing each component as a float. |
struct SK_STRUCT_ALIGN(16) SkPMFloat { |
float fColor[4]; |
+ // Normal POD copies and do-nothing initialization. |
+ SkPMFloat() = default; |
+ SkPMFloat(const SkPMFloat&) = default; |
+ SkPMFloat& operator=(const SkPMFloat&) = default; |
+ |
+ // Freely autoconvert between SkPMFloat and Sk4f. |
+ /*implicit*/ SkPMFloat(const Sk4f& fs) { fs.storeAligned(fColor); } |
+ /*implicit*/ operator Sk4f() const { return Sk4f::LoadAligned(fColor); } |
+ |
float a() const { return fColor[SK_A32_SHIFT / 8]; } |
float r() const { return fColor[SK_R32_SHIFT / 8]; } |
float g() const { return fColor[SK_G32_SHIFT / 8]; } |