Index: src/codec/SkJpegCodec.cpp |
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp |
index 6b97b2fe4ad3384b22b42a32e8c300ee88ab9d34..76d2ee85727f20e3d06e92e5b0aa1e7acfd1bd43 100644 |
--- a/src/codec/SkJpegCodec.cpp |
+++ b/src/codec/SkJpegCodec.cpp |
@@ -211,20 +211,17 @@ |
} |
if (codecOut) { |
- // Get the encoded color type |
- SkEncodedInfo::Color color = decoderMgr->getEncodedColor(); |
- if (SkEncodedInfo::kUnknown_Color == color) { |
- return false; |
- } |
+ // Recommend the color type to decode to |
+ const SkColorType colorType = decoderMgr->getColorType(); |
// Create image info object and the codec |
- SkEncodedInfo info = SkEncodedInfo::Make(color, SkEncodedInfo::kOpaque_Alpha, 8); |
+ const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->image_width, |
+ decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType); |
Origin orientation = get_exif_orientation(decoderMgr->dinfo()); |
sk_sp<SkColorSpace> colorSpace = get_icc_profile(decoderMgr->dinfo()); |
- *codecOut = new SkJpegCodec(decoderMgr->dinfo()->image_width, |
- decoderMgr->dinfo()->image_height, info, stream, decoderMgr.release(), colorSpace, |
+ *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.release(), colorSpace, |
orientation); |
} else { |
SkASSERT(nullptr != decoderMgrOut); |
@@ -245,9 +242,9 @@ |
return nullptr; |
} |
-SkJpegCodec::SkJpegCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream, |
+SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, |
JpegDecoderMgr* decoderMgr, sk_sp<SkColorSpace> colorSpace, Origin origin) |
- : INHERITED(width, height, info, stream, colorSpace, origin) |
+ : INHERITED(srcInfo, stream, colorSpace, origin) |
, fDecoderMgr(decoderMgr) |
, fReadyState(decoderMgr->dinfo()->global_state) |
, fSwizzlerSubset(SkIRect::MakeEmpty()) |