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

Unified Diff: include/core/SkColorSpace.h

Issue 2067833003: Differentiate between sRGBGamma and 2Dot2Gamma (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix DefaultXform 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 | « gm/color4f.cpp ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkColorSpace.h
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h
index f942780b7c73a9a0936f044f977693b5065826ba..ef6d277b695e91f1b8e24c7a2e01695b92132e8b 100644
--- a/include/core/SkColorSpace.h
+++ b/include/core/SkColorSpace.h
@@ -23,27 +23,18 @@ public:
kAdobeRGB_Named,
};
- /**
- * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ.
- */
- static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& toXYZD50);
-
- /**
- * Create a common, named SkColorSpace.
- */
- static sk_sp<SkColorSpace> NewNamed(Named);
-
- /**
- * Create an SkColorSpace from an ICC profile.
- */
- static sk_sp<SkColorSpace> NewICC(const void*, size_t);
-
enum GammaNamed {
kLinear_GammaNamed,
/**
- * Gamma curve is a close match to the 2.2f exponential curve. This is by far
- * the most common gamma, and is used by sRGB and Adobe RGB profiles.
+ * Gamma curve is a close match to the canonical sRGB curve, which has
+ * a short linear segment followed by a 2.4f exponential.
+ */
+ kSRGB_GammaNamed,
+
+ /**
+ * Gamma curve is a close match to the 2.2f exponential curve. This is
+ * used by Adobe RGB profiles and is common on monitors as well.
*/
k2Dot2Curve_GammaNamed,
@@ -55,6 +46,21 @@ public:
kNonStandard_GammaNamed,
};
+ /**
+ * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ.
+ */
+ static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& toXYZD50);
+
+ /**
+ * Create a common, named SkColorSpace.
+ */
+ static sk_sp<SkColorSpace> NewNamed(Named);
+
+ /**
+ * Create an SkColorSpace from an ICC profile.
+ */
+ static sk_sp<SkColorSpace> NewICC(const void*, size_t);
+
GammaNamed gammaNamed() const { return fGammaNamed; }
/**
@@ -62,6 +68,13 @@ public:
*/
const SkMatrix44& xyz() const { return fToXYZD50; }
+ /**
+ * Returns true if the color space gamma is near enough to be approximated as sRGB.
+ */
+ bool gammaCloseToSRGB() const {
+ return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGammaNamed;
+ }
+
protected:
SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named);
« no previous file with comments | « gm/color4f.cpp ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698