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

Unified Diff: include/codec/SkCodec.h

Issue 1212593003: Destroy SkScanlineDecoder in the SkCodec subclass destructors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Detachable SkScanlineDecoder 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
« no previous file with comments | « no previous file | include/codec/SkScanlineDecoder.h » ('j') | include/codec/SkScanlineDecoder.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 2e47a261f3924f2b018d988af56440f4310de2d3..e462be2e7d64c494de89cc03241da7c5de4c08d9 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -168,15 +168,32 @@ protected:
*/
RewindState SK_WARN_UNUSED_RESULT rewindIfNeeded();
- /*
- *
+ /**
* Get method for the input stream
- *
*/
SkStream* stream() {
return fStream.get();
}
+ /**
+ * If the codec has a scanline decoder, return it (no ownership change occurs)
+ * else return NULL.
+ * The returned decoder is valid while the codec exists and the client has not
+ * created a new scanline decoder.
+ */
+ SkScanlineDecoder* scanlineDecoder() {
+ return fScanlineDecoder.get();
+ }
+
+ /**
+ * Allow the codec subclass to detach and take ownership of the scanline decoder.
+ * This will likely be used when the scanline decoder needs to be destroyed
+ * in the destructor of the subclass.
+ */
+ SkScanlineDecoder* detachScanlineDecoder() {
+ return fScanlineDecoder.detach();
+ }
+
private:
SkAutoTDelete<SkStream> fStream;
bool fNeedsRewind;
« no previous file with comments | « no previous file | include/codec/SkScanlineDecoder.h » ('j') | include/codec/SkScanlineDecoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698