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

Unified Diff: src/core/SkColorSpacePriv.h

Issue 2159253005: Revert of Refactor parsing and storage of SkGammas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/SkColorSpace.cpp ('k') | src/core/SkColorSpaceXform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpacePriv.h
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h
index e7c8aaa10382345f44a30449f43fe1b55844952e..7c7b9d0c2146978f66ca385fa79276898e7bb486 100644
--- a/src/core/SkColorSpacePriv.h
+++ b/src/core/SkColorSpacePriv.h
@@ -10,3 +10,16 @@
inline bool color_space_almost_equal(float a, float b) {
return SkTAbs(a - b) < 0.01f;
}
+
+inline void set_gamma_value(SkGammaCurve* gamma, float value) {
+ if (color_space_almost_equal(2.2f, value)) {
+ gamma->fNamed = SkColorSpace::k2Dot2Curve_GammaNamed;
+ } else if (color_space_almost_equal(1.0f, value)) {
+ gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
+ } else if (color_space_almost_equal(0.0f, value)) {
+ SkColorSpacePrintf("Treating invalid zero gamma as linear.");
+ gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
+ } else {
+ gamma->fValue = value;
+ }
+}
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | src/core/SkColorSpaceXform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698