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

Unified Diff: src/core/SkColor.cpp

Issue 1891013002: WIP: runtime switch for how to interpret SkColor -vs- srgb (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkPM4fPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | src/core/SkPM4fPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698