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

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 1212593003: Destroy SkScanlineDecoder in the SkCodec subclass destructors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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
« include/codec/SkCodec.h ('K') | « src/codec/SkCodec_libpng.cpp ('k') | no next file » | 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 2eaff1a9a67f47be24d70c6e7dddba21fd056350..4eb63cc925536e9485c7d8a3c3b2e5b94236320d 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -297,6 +297,12 @@ 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()) {
+ fDecoderMgr->returnFailure("cannot getPixels() if a scanline decoder has been created",
scroggo 2015/06/29 21:33:22 I think this should be: return fDecoderMgr->.
msarett 2015/06/29 21:59:43 Yeah it should be!
+ kInvalidInput);
+ }
+
// Rewind the stream if needed
if (!this->handleRewind()) {
fDecoderMgr->returnFailure("could not rewind stream", kCouldNotRewind);
scroggo 2015/06/29 21:33:22 Again, this should be a return statement, right?
msarett 2015/06/29 21:59:43 Yep this is wrong too. That's what you get when y
@@ -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());
}
« include/codec/SkCodec.h ('K') | « src/codec/SkCodec_libpng.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698