aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-24 20:37:30 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-24 20:37:30 +0000
commitff36a1d07f23f2b7feddaba110d448073a96f83c (patch)
tree7285998ee8f22d7af2d5ffa0e49b186db87eb11b /include
parent1e182253f8358ad1bc46209e84d2b4058f1f16a6 (diff)
Start from scratch on a faster SkFlatDictionary.
This is like codereview.chromium.org/19276003, except it fits in better with the existing code, doesn't leak memory, and because it's back using SkChunkFlatController it's a little faster too, now a win across the board: Slowdown bench -1.59% desk_youtubetvbrowse.skp -2.56% desk_googlehome.skp -6.40% tabl_androidpolice.skp -6.45% desk_youtubetvvideo.skp -6.91% tabl_googlecalendar.skp ... -29.70% desk_yahoogames.skp -32.17% desk_googlespreadsheet.skp -32.23% mobi_wikipedia.skp -37.16% desk_chalkboard.skp -41.57% desk_pokemonwiki.skp Overall slowdown: -22.74% running bench [640 480] picture_record_recurring_paint_dictionary NONRENDERING: cmsecs = 9.92 running bench [640 480] picture_record_unique_paint_dictionary NONRENDERING: cmsecs = 22.16 running bench [640 480] picture_record_dictionaries NONRENDERING: cmsecs = 9.18 BUG= Committed: http://code.google.com/p/skia/source/detail?r=10328 R=tomhudson@google.com, reed@google.com, scroggo@google.com Author: mtklein@google.com Review URL: https://chromiumcodereview.appspot.com/19564007 git-svn-id: http://skia.googlecode.com/svn/trunk@10336 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkWriter32.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 51044ab00e..82cf346c8e 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;