aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkJpegCodec.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-19 04:41:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-19 04:41:12 -0700
commit3c920243f831de5892857f86618fd9c4f9655ba2 (patch)
tree798ff75b06c4b51520a6f1ea3cd1666ebe4a7573 /src/codec/SkJpegCodec.cpp
parentf682d9ad70d690a343bc15e26ef321d86770be41 (diff)
Revert of Add SkEncodedInfo to report properties of encoded image data (patchset #6 id:200001 of https://codereview.chromium.org/1820073002/ )
Reason for revert: Lots of bots failing Original issue's description: > Add SkEncodedInfo to report properties of encoded image data > > All this does is build an SkEncodedInfo for each codec, and > then convert it to an SkImageInfo. > > In future steps I intend to: > (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler. > (2) Support more conversions in SkSwizzler (non-native > BGRA/RGBA, 16-bit components, float, fixed point) > (3) Investigate optimizing conversions from encoded data > to linear color spaces. > > BUG=skia:4133 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002 > > Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41 TBR=scroggo@google.com,reed@google.com,msarett@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4133 Review URL: https://codereview.chromium.org/1895383002
Diffstat (limited to 'src/codec/SkJpegCodec.cpp')
-rw-r--r--src/codec/SkJpegCodec.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 6b97b2fe4a..76d2ee8572 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -211,20 +211,17 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
}
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 @@ SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
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())