aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-07-11 11:59:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-11 16:25:21 +0000
commit39ef556d7c6ea15f0c6afd7707d338cdfd41084a (patch)
treed0e6b108af701311e03047614709ce1d71aee0c7
parent64778d9f275d8ce3df8f4ab39ff334b7ef5b70d3 (diff)
Correctly set encoder options according to color space
The default value is kRespect, so we were always using that value. Replace that with more explicit (and correct) logic. Bug: skia: Change-Id: I6984a96fa16033f41824851cade3ff046b0fae94 Reviewed-on: https://skia-review.googlesource.com/22260 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r--gm/encode-srgb.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/gm/encode-srgb.cpp b/gm/encode-srgb.cpp
index 3369afe4dc..5e9be4b339 100644
--- a/gm/encode-srgb.cpp
+++ b/gm/encode-srgb.cpp
@@ -121,10 +121,10 @@ static sk_sp<SkData> encode_data(const SkBitmap& bitmap, SkEncodedImageFormat fo
SkPngEncoder::Options pngOptions;
SkWebpEncoder::Options webpOptions;
- if (bitmap.colorSpace()) {
- pngOptions.fUnpremulBehavior = SkTransferFunctionBehavior::kRespect;
- webpOptions.fUnpremulBehavior = SkTransferFunctionBehavior::kRespect;
- }
+ SkTransferFunctionBehavior behavior = bitmap.colorSpace()
+ ? SkTransferFunctionBehavior::kRespect : SkTransferFunctionBehavior::kIgnore;
+ pngOptions.fUnpremulBehavior = behavior;
+ webpOptions.fUnpremulBehavior = behavior;
switch (format) {
case SkEncodedImageFormat::kPNG: