Index: src/core/SkColor.cpp |
diff --git a/src/core/SkColor.cpp b/src/core/SkColor.cpp |
index a1404a27e360288ad930d45cc3c0a1c876593f85..39e9aafa929f0d30a971a40bb10781d8a0d3bf36 100644 |
--- a/src/core/SkColor.cpp |
+++ b/src/core/SkColor.cpp |
@@ -106,10 +106,7 @@ SkColor SkHSVToColor(U8CPU a, const SkScalar hsv[3]) { |
#include "SkHalf.h" |
SkPM4f SkPM4f::FromPMColor(SkPMColor c) { |
- Sk4f value = to_4f_rgba(c); |
- SkPM4f c4; |
- (value * Sk4f(1.0f / 255)).store(&c4); |
- return c4; |
+ return From4f(swizzle_rb_if_bgra(Sk4f_fromL32(c))); |
} |
SkColor4f SkPM4f::unpremul() const { |
@@ -152,21 +149,14 @@ void SkPM4f::assertIsUnit() const { |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
-SkColor4f SkColor4f::FromColor(SkColor c) { |
- Sk4f value = SkNx_shuffle<2,1,0,3>(SkNx_cast<float>(Sk4b::Load(&c))); |
- SkColor4f c4; |
- (value * Sk4f(1.0f / 255)).store(&c4); |
- c4.fR = srgb_to_linear(c4.fR); |
- c4.fG = srgb_to_linear(c4.fG); |
- c4.fB = srgb_to_linear(c4.fB); |
- return c4; |
+SkColor4f SkColor4f::FromColor(SkColor bgra) { |
+ SkColor4f rgba; |
+ swizzle_rb(Sk4f_fromS32(bgra)).store(rgba.vec()); |
+ return rgba; |
} |
SkColor SkColor4f::toSkColor() const { |
- SkColor result; |
- Sk4f value = Sk4f(linear_to_srgb(fB), linear_to_srgb(fG), linear_to_srgb(fR), fA); |
- SkNx_cast<uint8_t>(value * Sk4f(255) + Sk4f(0.5f)).store(&result); |
- return result; |
+ return Sk4f_toS32(swizzle_rb(Sk4f::Load(this->vec()))); |
} |
SkColor4f SkColor4f::Pin(float r, float g, float b, float a) { |