Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1017)

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 1820073002: Add SkEncodedInfo to report properties of encoded image data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Order of param eval bug Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkJpegCodec.h ('k') | src/codec/SkJpegDecoderMgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkJpegCodec.cpp
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 76d2ee85727f20e3d06e92e5b0aa1e7acfd1bd43..88b7fcbde1b17c8c97209663e18f5b7b86dbec1c 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -211,17 +211,21 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
}
if (codecOut) {
- // Recommend the color type to decode to
- const SkColorType colorType = decoderMgr->getColorType();
+ // Get the encoded color type
+ SkEncodedInfo::Color color = decoderMgr->getEncodedColor();
+ if (SkEncodedInfo::kUnknown_Color == color) {
+ return false;
+ }
// Create image info object and the codec
- const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->image_width,
- decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType);
+ SkEncodedInfo info = SkEncodedInfo::Make(color, SkEncodedInfo::kOpaque_Alpha, 8);
Origin orientation = get_exif_orientation(decoderMgr->dinfo());
sk_sp<SkColorSpace> colorSpace = get_icc_profile(decoderMgr->dinfo());
- *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.release(), colorSpace,
+ const int width = decoderMgr->dinfo()->image_width;
+ const int height = decoderMgr->dinfo()->image_height;
+ *codecOut = new SkJpegCodec(width, height, info, stream, decoderMgr.release(), colorSpace,
orientation);
} else {
SkASSERT(nullptr != decoderMgrOut);
@@ -242,9 +246,9 @@ SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
return nullptr;
}
-SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream,
+SkJpegCodec::SkJpegCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream,
JpegDecoderMgr* decoderMgr, sk_sp<SkColorSpace> colorSpace, Origin origin)
- : INHERITED(srcInfo, stream, colorSpace, origin)
+ : INHERITED(width, height, info, stream, colorSpace, origin)
, fDecoderMgr(decoderMgr)
, fReadyState(decoderMgr->dinfo()->global_state)
, fSwizzlerSubset(SkIRect::MakeEmpty())
« no previous file with comments | « src/codec/SkJpegCodec.h ('k') | src/codec/SkJpegDecoderMgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698