Index: src/core/SkColor.cpp |
diff --git a/src/core/SkColor.cpp b/src/core/SkColor.cpp |
index ab6330011978610a999ca1effe02161cbf495ad8..1c6f0b65792e91b0591c8e711d1a37e7edd590ab 100644 |
--- a/src/core/SkColor.cpp |
+++ b/src/core/SkColor.cpp |
@@ -9,6 +9,8 @@ |
#include "SkColorPriv.h" |
#include "SkFixed.h" |
+bool gTreatSkColorAsSRGB; |
+ |
SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { |
return SkPremultiplyARGBInline(a, r, g, b); |
} |
@@ -156,6 +158,11 @@ SkColor4f SkColor4f::FromColor(SkColor c) { |
Sk4f value = SkNx_shuffle<3,2,1,0>(SkNx_cast<float>(Sk4b::Load(&c))); |
SkColor4f c4; |
(value * Sk4f(1.0f / 255)).store(&c4); |
+ if (gTreatSkColorAsSRGB) { |
+ c4.fR = srgb_to_linear(c4.fR); |
+ c4.fG = srgb_to_linear(c4.fG); |
+ c4.fB = srgb_to_linear(c4.fB); |
+ } |
return c4; |
} |