aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-03-06 11:11:23 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-06 17:26:09 +0000
commitd83545e4904ba78c6bc7b82169e9be5070f64e32 (patch)
tree885c81d369c652cf06ef9d293e0f21a597d3bd36 /include
parent92004807f2dffea2d4a694e49434ce4c0bcfb28d (diff)
Add SkColorSpace::isSRGB()
BUG=skia: Change-Id: I124480a15e0c3cb01f4e22397c0a116f2d1c0d7d Reviewed-on: https://skia-review.googlesource.com/9239 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkColorSpace.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h
index 978660b135..c945703549 100644
--- a/include/core/SkColorSpace.h
+++ b/include/core/SkColorSpace.h
@@ -106,6 +106,8 @@ public:
/**
* Returns true if the color space gamma is near enough to be approximated as sRGB.
+ * This includes the canonical sRGB transfer function as well as a 2.2f exponential
+ * transfer function.
*/
bool gammaCloseToSRGB() const;
@@ -129,6 +131,20 @@ public:
bool toXYZD50(SkMatrix44* toXYZD50) const;
/**
+ * Returns true if the color space is sRGB.
+ * Returns false otherwise.
+ *
+ * This allows a little bit of tolerance, given that we might see small numerical error
+ * in some cases: converting ICC fixed point to float, converting white point to D50,
+ * rounding decisions on transfer function and matrix.
+ *
+ * This does not consider a 2.2f exponential transfer function to be sRGB. While these
+ * functions are similar (and it is sometimes useful to consider them together), this
+ * function checks for logical equality.
+ */
+ bool isSRGB() const;
+
+ /**
* Returns nullptr on failure. Fails when we fallback to serializing ICC data and
* the data is too large to serialize.
*/