aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bookmaker/definition.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-01-03 08:37:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-03 14:21:19 +0000
commit61dfc3a53d9d47843dc80b0a61e445e86a482185 (patch)
tree16fbd517e4c532f8cd1df89a93142af044651109 /tools/bookmaker/definition.cpp
parent36add77b9cde8c370eebbefc38960da42867f4c0 (diff)
support srgb flag in bookmaker
allow examples to work with colorspace fix point array plural form fix spacing after private message add some SkImage documentation TBR=caryclark@google.com Docs-Preview: https://skia.org/?cl=90360 Bug: skia:6898 Change-Id: I045ee68e7dd9747ec5d40d95588bbc1594c45366 Reviewed-on: https://skia-review.googlesource.com/90360 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/definition.cpp')
-rw-r--r--tools/bookmaker/definition.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/bookmaker/definition.cpp b/tools/bookmaker/definition.cpp
index 933ecc6868..77f4446445 100644
--- a/tools/bookmaker/definition.cpp
+++ b/tools/bookmaker/definition.cpp
@@ -526,6 +526,7 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
string normalizedName(fFiddle);
string code;
string imageStr = "0";
+ string srgbStr = "false";
for (auto const& iter : fChildren) {
switch (iter->fMarkType) {
case MarkType::kError:
@@ -562,6 +563,15 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
case MarkType::kPlatform:
// ignore for now
break;
+ case MarkType::kSet:
+ if ("sRGB" == string(iter->fContentStart,
+ iter->fContentEnd - iter->fContentStart)) {
+ srgbStr = "true";
+ } else {
+ SkASSERT(0); // more work to do
+ return false;
+ }
+ break;
case MarkType::kStdOut:
textOut = true;
break;
@@ -609,7 +619,7 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
example += " \"width\": " + widthStr + ",\n";
example += " \"height\": " + heightStr + ",\n";
example += " \"source\": " + imageStr + ",\n";
- example += " \"srgb\": false,\n";
+ example += " \"srgb\": " + srgbStr + ",\n";
example += " \"f16\": false,\n";
example += " \"textOnly\": " + textOutStr + ",\n";
example += " \"animated\": false,\n";