Chromium Code Reviews| Index: src/codec/SkScanlineDecoder.cpp |
| diff --git a/src/codec/SkScanlineDecoder.cpp b/src/codec/SkScanlineDecoder.cpp |
| index 00c020c7c276c82e72808dd7b64e18dfc91417fc..50fc4ed26c46416d17d132c17dc5eca137169a4a 100644 |
| --- a/src/codec/SkScanlineDecoder.cpp |
| +++ b/src/codec/SkScanlineDecoder.cpp |
| @@ -7,6 +7,7 @@ |
| #include "SkScanlineDecoder.h" |
| #include "SkCodec_libpng.h" |
| +#include "SkCodec_wbmp.h" |
| #include "SkCodecPriv.h" |
| #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| #include "SkJpegCodec.h" |
| @@ -22,6 +23,7 @@ static const DecoderProc gDecoderProcs[] = { |
| #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| { SkJpegCodec::IsJpeg, SkJpegCodec::NewSDFromStream }, |
| #endif |
| + { SkWbmpCodec::IsWbmp, SkWbmpCodec::NewSDFromStream }, |
| }; |
| SkScanlineDecoder* SkScanlineDecoder::NewFromStream(SkStream* stream) { |
| @@ -66,6 +68,19 @@ SkScanlineDecoder* SkScanlineDecoder::NewFromData(SkData* data) { |
| SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo, |
| const SkCodec::Options* options, SkPMColor ctable[], int* ctableCount) { |
| + // Ensure that valid color ptrs are passed in for kIndex8 color type |
| + if (kIndex_8_SkColorType == dstInfo.colorType()) { |
| + if (NULL == ctable || NULL == ctableCount) { |
| + return SkCodec::kInvalidConversion; |
| + } |
| + } else { |
| + if (ctableCount) { |
| + *ctableCount = 0; |
| + } |
| + ctableCount = NULL; |
| + ctable = NULL; |
| + } |
| + |
| // Set options. |
| SkCodec::Options optsStorage; |
| if (NULL == options) { |
| @@ -83,10 +98,6 @@ SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo, |
| } |
| SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo) { |
| - SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); |
|
scroggo
2015/08/04 20:24:11
This line is actually important - we cannot suppor
msarett
2015/08/04 21:21:26
Happy to add this back in. I'm just unclear why i
scroggo
2015/08/05 14:36:20
Oh, no; you were right to remove it. Say goodbye t
msarett
2015/08/05 15:29:42
Done.
|
| - if (kIndex_8_SkColorType == dstInfo.colorType()) { |
| - return SkCodec::kInvalidConversion; |
| - } |
| return this->start(dstInfo, NULL, NULL, NULL); |
| } |