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

Unified Diff: src/core/SkPM4fPriv.h

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 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/SkNx.h ('k') | src/gpu/GrDrawContext.cpp » ('j') | 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 f2d2557d3a780e57a84c1d86d4789dcf0cb861f9..89a0caeb70ce0ff0994efbe3faf77f7f4a823268 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -55,4 +55,20 @@
return swizzle_rb(Sk4f_fromS32(color));
}
+static inline void assert_unit(float x) {
+ SkASSERT(0 <= x && x <= 1);
+}
+
+static inline float exact_srgb_to_linear(float srgb) {
+ assert_unit(srgb);
+ float linear;
+ if (srgb <= 0.04045) {
+ linear = srgb / 12.92f;
+ } else {
+ linear = powf((srgb + 0.055f) / 1.055f, 2.4f);
+ }
+ assert_unit(linear);
+ return linear;
+}
+
#endif
« no previous file with comments | « src/core/SkNx.h ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698