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

Unified Diff: src/core/SkPMFloat.h

Issue 1061603002: Code's more readable when SkPMFloat is an Sk4f. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fix neon Created 5 years, 9 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 | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPMFloat.h
diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h
index a327025f3c85d0d095cd44dc4cec44d2d91c744d..eb575f2ee4520b92c204ad2bdde8e6bd7f1b0857 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 SK_STRUCT_ALIGN(16) SkPMFloat {
+class SkPMFloat : public Sk4f {
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,20 +28,17 @@ public:
explicit SkPMFloat(SkPMColor);
SkPMFloat(float a, float r, float g, float b)
#ifdef SK_PMCOLOR_IS_RGBA
- : fColors(r,g,b,a) {}
+ : INHERITED(r,g,b,a) {}
#else
- : fColors(b,g,r,a) {}
+ : INHERITED(b,g,r,a) {}
#endif
+ SkPMFloat(const Sk4f& fs) : INHERITED(fs) {}
- // 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<SK_A32_SHIFT / 8>(); }
- float r() const { return fColors.kth<SK_R32_SHIFT / 8>(); }
- float g() const { return fColors.kth<SK_G32_SHIFT / 8>(); }
- float b() const { return fColors.kth<SK_B32_SHIFT / 8>(); }
+ float a() const { return this->kth<SK_A32_SHIFT / 8>(); }
+ float r() const { return this->kth<SK_R32_SHIFT / 8>(); }
+ float g() const { return this->kth<SK_G32_SHIFT / 8>(); }
+ float b() const { return this->kth<SK_B32_SHIFT / 8>(); }
// N.B. All methods returning an SkPMColor call SkPMColorAssert on that result before returning.
@@ -67,7 +64,7 @@ public:
}
private:
- Sk4f fColors;
+ typedef Sk4f INHERITED;
};
#ifdef SKNX_NO_SIMD
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698