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

Unified Diff: src/core/SkPM4fPriv.h

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 | « src/core/SkColor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPM4fPriv.h
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 48fdde7acd0df0ad178f7d5062de751e0452d47f..b75dc71654e9a99023e43f060794186b1b89230a 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -11,6 +11,8 @@
#include "SkColorPriv.h"
#include "SkPM4f.h"
+extern bool gTreatSkColorAsSRGB;
+
static inline float get_alpha(const Sk4f& f4) {
return f4[SkPM4f::A];
}
@@ -42,6 +44,14 @@ static inline Sk4f linear_to_srgb(const Sk4f& l4) {
return set_alpha(l4.sqrt(), get_alpha(l4));
}
+static inline float srgb_to_linear(float x) {
+ return x * x;
+}
+
+static inline float linear_to_srgb(float x) {
+ return sqrtf(x);
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
static inline Sk4f Sk4f_fromL32(uint32_t src) {
« no previous file with comments | « src/core/SkColor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698