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

Unified Diff: src/codec/SkCodec_libpng.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
Index: src/codec/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 444e2ad87e0ae14a3bfd95746fd991f592c7ceca..c8d331db52bae2d4931e334b034b72d34135a49f 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -514,6 +514,12 @@ bool SkPngCodec::handleRewind() {
SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void* dst,
size_t rowBytes, const Options& options,
SkPMColor ctable[], int* ctableCount) {
+ // Do not allow a regular decode if the caller has asked for a scanline decoder
+ if (NULL != this->scanlineDecoder()) {
+ SkCodecPrintf("cannot getPixels() if a scanline decoder has been created\n");
+ return kInvalidInput;
+ }
+
if (!this->handleRewind()) {
return kCouldNotRewind;
}
@@ -734,7 +740,7 @@ private:
-
+
typedef SkScanlineDecoder INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698