From e758579d4f85f4615d62e87847dd3f8b38e3a6e2 Mon Sep 17 00:00:00 2001 From: mtklein Date: Fri, 3 Apr 2015 12:47:48 -0700 Subject: Revert of Code's more readable when SkPMFloat is an Sk4f. (patchset #3 id:40001 of https://codereview.chromium.org/1061603002/) Reason for revert: missed some neon code Original issue's description: > Code's more readable when SkPMFloat is an Sk4f. > #floats > > BUG=skia: > BUG=skia:3592 > > Committed: https://skia.googlesource.com/skia/+/6b5dab889579f1cc9e1b5278f4ecdc4c63fe78c9 TBR=reed@google.com,mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1056143004 --- src/core/SkPMFloat.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/core/SkPMFloat.h') diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h index eb575f2ee4..a327025f3c 100644 --- a/src/core/SkPMFloat.h +++ b/src/core/SkPMFloat.h @@ -15,7 +15,7 @@ // A pre-multiplied color storing each component in the same order as SkPMColor, // but as a float in the range [0, 255]. -class SkPMFloat : public Sk4f { +class SK_STRUCT_ALIGN(16) SkPMFloat { public: static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); } static SkPMFloat FromARGB(float a, float r, float g, float b) { return SkPMFloat(a,r,g,b); } @@ -28,17 +28,20 @@ public: explicit SkPMFloat(SkPMColor); SkPMFloat(float a, float r, float g, float b) #ifdef SK_PMCOLOR_IS_RGBA - : INHERITED(r,g,b,a) {} + : fColors(r,g,b,a) {} #else - : INHERITED(b,g,r,a) {} + : fColors(b,g,r,a) {} #endif - SkPMFloat(const Sk4f& fs) : INHERITED(fs) {} - float a() const { return this->kth(); } - float r() const { return this->kth(); } - float g() const { return this->kth(); } - float b() const { return this->kth(); } + // Freely autoconvert between SkPMFloat and Sk4f. + /*implicit*/ SkPMFloat(const Sk4f& fs) { fColors = fs; } + /*implicit*/ operator Sk4f() const { return fColors; } + + float a() const { return fColors.kth(); } + float r() const { return fColors.kth(); } + float g() const { return fColors.kth(); } + float b() const { return fColors.kth(); } // N.B. All methods returning an SkPMColor call SkPMColorAssert on that result before returning. @@ -64,7 +67,7 @@ public: } private: - typedef Sk4f INHERITED; + Sk4f fColors; }; #ifdef SKNX_NO_SIMD -- cgit v1.2.3