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

Unified Diff: include/core/SkWriter32.h

Issue 19564007: Start from scratch on a faster SkFlatDictionary. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix windows build by making AllocScratch static Created 7 years, 5 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/SkOrderedWriteBuffer.h » ('j') | src/core/SkPictureFlat.h » ('J')
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 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;
« no previous file with comments | « no previous file | src/core/SkOrderedWriteBuffer.h » ('j') | src/core/SkPictureFlat.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698