Use non-linear color spaces for Android decode outputs
BUG=skia:
Change-Id: Ic4bce28f4bc45f73cbfcacc3630140d11fa9c41f
Reviewed-on: https://skia-review.googlesource.com/8530
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index e9eeb45..c31d533 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -474,7 +474,17 @@
}
}
-bool SkCodec::initializeColorXform(const SkImageInfo& dstInfo) {
+bool SkCodec::initializeColorXform(const SkImageInfo& info) {
+ // TODO (msarett):
+ // Handle equality checking and legacy behavior for flagged SkColorSpaces.
+ // Until this is implemented, remove any flags on output color spaces. This
+ // will prevent strange behaviors. Ex: sRGB != sRGB + flag, but we don't want
+ // this to trigger a color xform.
+ SkImageInfo dstInfo = info;
+ if (dstInfo.colorSpace()) {
+ dstInfo = info.makeColorSpace(as_CSB(dstInfo.colorSpace())->makeWithoutFlags());
+ }
+
fColorXform = nullptr;
bool needsPremul = needs_premul(dstInfo, fEncodedInfo);
if (needs_color_xform(dstInfo, fSrcInfo, needsPremul)) {