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

Unified Diff: src/core/SkColorSpacePriv.h

Issue 2101823003: Move SkColorSpace ICC parsing/writing code to its own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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/SkColorSpace_ICC.cpp » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..7c7b9d0c2146978f66ca385fa79276898e7bb486
--- /dev/null
+++ b/src/core/SkColorSpacePriv.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#define SkColorSpacePrintf(...)
+
+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/SkColorSpace_ICC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698