aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-02-03 15:03:58 -0800
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-06 14:00:13 +0000
commit0312a0cec95a9002f27ba88f7d24de25111a4e2d (patch)
tree2452a7823fa4b6b3600bfb19e6acf21f49d8bc32
parentb3050b91f0ceed2f76e8049e222409c9a4c9b37e (diff)
Add toXYZD50() to SkColorSpace API
BUG=skia: Change-Id: I996877c9482453fc5ff58b0f66fa29715bea2191 Reviewed-on: https://skia-review.googlesource.com/8024 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Mike Reed <reed@google.com>
-rw-r--r--include/core/SkColorSpace.h6
-rw-r--r--src/core/SkColorSpace.cpp10
2 files changed, 16 insertions, 0 deletions
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h
index 6c0db85d7b..1bcb44fbc5 100644
--- a/include/core/SkColorSpace.h
+++ b/include/core/SkColorSpace.h
@@ -118,6 +118,12 @@ public:
bool gammaIsLinear() const;
/**
+ * Returns true and sets |toXYZD50| if the color gamut can be described as a matrix.
+ * Returns false otherwise.
+ */
+ bool toXYZD50(SkMatrix44* toXYZD50) const;
+
+ /**
* Returns nullptr on failure. Fails when we fallback to serializing ICC data and
* the data is too large to serialize.
*/
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 239a61bcce..3c1ce257f1 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -242,6 +242,16 @@ bool SkColorSpace::gammaIsLinear() const {
return as_CSB(this)->onGammaIsLinear();
}
+bool SkColorSpace::toXYZD50(SkMatrix44* toXYZD50) const {
+ const SkMatrix44* matrix = as_CSB(this)->toXYZD50();
+ if (matrix) {
+ *toXYZD50 = *matrix;
+ return true;
+ }
+
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
enum Version {