From e16b04aa6041efb6507546547737e9603fa1606e Mon Sep 17 00:00:00 2001 From: msarett Date: Wed, 15 Apr 2015 07:32:19 -0700 Subject: SkJpegCodec Enables basic decoding for jpegs Includes rewinding 565, YUV, and Jpeg encoding are not yet implemented BUG=skia:3257 Review URL: https://codereview.chromium.org/1076923002 --- dm/DM.cpp | 4 ++-- dm/DMSrcSink.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index c6d633c001..ff9dc57264 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -223,8 +223,8 @@ static bool codec_supported(const char* ext) { // FIXME: Once other versions of SkCodec are available, we can add them to this // list (and eventually we can remove this check once they are all supported). static const char* const exts[] = { - "bmp", "gif", "png", "ico", "wbmp", - "BMP", "GIF", "PNG", "ICO", "WBMP" + "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", + "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" }; for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index e70dd3e2b0..6b3ec9749e 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -83,7 +83,13 @@ Error CodecSrc::draw(SkCanvas* canvas) const { SkColorType canvasColorType = canvasInfo.colorType(); switch (fDstColorType) { case kIndex8_Always_DstColorType: + decodeInfo = codec->getInfo().makeColorType(kIndex_8_SkColorType); + if (kRGB_565_SkColorType == canvasColorType) { + return Error::Nonfatal("Testing non-565 to 565 is uninteresting."); + } + break; case kGrayscale_Always_DstColorType: + decodeInfo = codec->getInfo().makeColorType(kGray_8_SkColorType); if (kRGB_565_SkColorType == canvasColorType) { return Error::Nonfatal("Testing non-565 to 565 is uninteresting."); } -- cgit v1.2.3