| Index: src/codec/SkJpegCodec.cpp
|
| diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
|
| index 2eaff1a9a67f47be24d70c6e7dddba21fd056350..097729edec68d9878c2328edd61f6c056f42a76d 100644
|
| --- a/src/codec/SkJpegCodec.cpp
|
| +++ b/src/codec/SkJpegCodec.cpp
|
| @@ -297,9 +297,15 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| void* dst, size_t dstRowBytes,
|
| const Options& options, SkPMColor*, int*) {
|
|
|
| + // Do not allow a regular decode if the caller has asked for a scanline decoder
|
| + if (NULL != this->scanlineDecoder()) {
|
| + return fDecoderMgr->returnFailure("cannot getPixels() if a scanline decoder has been"
|
| + "created", kInvalidInput);
|
| + }
|
| +
|
| // Rewind the stream if needed
|
| if (!this->handleRewind()) {
|
| - fDecoderMgr->returnFailure("could not rewind stream", kCouldNotRewind);
|
| + return fDecoderMgr->returnFailure("could not rewind stream", kCouldNotRewind);
|
| }
|
|
|
| // Get a pointer to the decompress info since we will use it quite frequently
|
| @@ -449,6 +455,9 @@ public:
|
| return;
|
| }
|
|
|
| + // We may not have decoded the entire image. Prevent libjpeg-turbo from failing on a
|
| + // partial decode.
|
| + fCodec->fDecoderMgr->dinfo()->output_scanline = dstInfo().height();
|
| jpeg_finish_decompress(fCodec->fDecoderMgr->dinfo());
|
| }
|
|
|
|
|