Index: include/core/SkWriter32.h |
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h |
index 51044ab00ea0e3faa6387121b98dcf87067e7dfe..82cf346c8e6cb9f1fed856b71fbd094a29e3cd08 100644 |
--- a/include/core/SkWriter32.h |
+++ b/include/core/SkWriter32.h |
@@ -46,10 +46,17 @@ public: |
// return the current offset (will always be a multiple of 4) |
uint32_t bytesWritten() const { return fSize; } |
- // DEPRECATED: use byetsWritten instead |
+ // DEPRECATED: use bytesWritten instead TODO(mtklein): clean up |
uint32_t size() const { return this->bytesWritten(); } |
- void reset(); |
+ // Returns true if we've written only into the storage passed into constructor or reset. |
+ // (You may be able to use this to avoid a call to flatten.) |
+ bool wroteOnlyToStorage() const { |
+ return fHead == &fExternalBlock && this->bytesWritten() <= fExternalBlock.fSizeOfBlock; |
+ } |
+ |
+ void reset(); |
+ void reset(void* storage, size_t size); |
// size MUST be multiple of 4 |
uint32_t* reserve(size_t size) { |
@@ -63,8 +70,6 @@ public: |
return block->alloc(size); |
} |
- void reset(void* storage, size_t size); |
- |
bool writeBool(bool value) { |
this->writeInt(value); |
return value; |