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

Unified Diff: include/core/SkWriter32.h

Issue 155863005: Adding release method to SkWriter32 and using it to not copy the ops data from SkPictureRecord to S… (Closed) Base URL: https://skia.googlesource.com/skia.git@array_growth
Patch Set: Rebase patch Created 6 years, 10 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 | src/core/SkPicturePlayback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkWriter32.h
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 7d8d764e5944123a0819204dd0863f6a1b84bacb..4bff6933c4f56cf87c215bd13a339f5a67659c8c 100644
--- a/include/core/SkWriter32.h
+++ b/include/core/SkWriter32.h
@@ -21,6 +21,8 @@
#include "SkTDArray.h"
#include "SkTypes.h"
+class SkData;
+
class SkWriter32 : SkNoncopyable {
public:
/**
@@ -31,10 +33,10 @@ public:
* This used to be optional behavior, but pipe now relies on it.
*/
SkWriter32(void* external = NULL, size_t externalBytes = 0)
- : fData(0)
+ : fData(NULL)
, fCapacity(0)
, fUsed(0)
- , fExternal(0)
+ , fExternal(NULL)
{
this->reset(external, externalBytes);
}
@@ -229,6 +231,13 @@ public:
return stream->read(this->reservePad(length), length);
}
+ /**
+ * Release the internal buffer to the caller in an SkData.
+ * The caller must call unref() when it is finished using the data.
+ * This also clears the writer to empty as if you had called reset().
+ */
+ SkData* detatchAsData();
+
private:
void growToAtLeast(size_t size);
« no previous file with comments | « no previous file | src/core/SkPicturePlayback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698