aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPM4fPriv.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-04-15 10:48:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 10:48:01 -0700
commit87a0c223e3685b303d6b14955d398e651f8b8c84 (patch)
tree59d623a15d98c69315bc09ab4fb093ddf0d18645 /src/core/SkPM4fPriv.h
parent6d7cd1f421dbde43dd2db655ca477c05312ec5fd (diff)
WIP: runtime switch for how to interpret SkColor -vs- srgb
Still very conflicted about the "right" way to proceed with this, but thought I'd experiment with a runtime flag, so we can practice seeing SKPs in various stages of "srgb correctness". Other aspects to either fix, or at least provide runtime switches for: - untagged images - gradients - colorshader - drawVertices BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1891013002 TBR= Review URL: https://codereview.chromium.org/1891013002
Diffstat (limited to 'src/core/SkPM4fPriv.h')
-rw-r--r--src/core/SkPM4fPriv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 48fdde7acd..b75dc71654 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) {