SkDynamicMemoryWStream::detachAsData more memory efficent
I did some testing with very large datasets, and the difference in max
RSS is measurable and significant.
Change-Id: I6bb2f795d5b4f6ebdba42c3089dc85a278355d48
Reviewed-on: https://skia-review.googlesource.com/9686
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 10929a8..8df59af 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -376,6 +376,9 @@
void copyTo(void* dst) const;
void writeToStream(SkWStream* dst) const;
+ /** Equivalent to copyTo() followed by reset(), but may save memory use. */
+ void copyToAndReset(void* dst);
+
/** Return the contents as SkData, and then reset the stream. */
sk_sp<SkData> detachAsData();