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

Unified Diff: src/core/SkPictureFlat.cpp

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
Index: src/core/SkPictureFlat.cpp
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index e9eec0fb00b69f38189e02c0dc7fa777b0f9c7b6..2c6efa2a8fd39ed39d4430629f7dc19958c17f0b 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -94,6 +94,14 @@ SkNamedFactorySet* SkFlatController::setNamedFactorySet(SkNamedFactorySet* set)
///////////////////////////////////////////////////////////////////////////////
+void SkFlatData::stampHeaderAndSentinel(int index, int32_t size) {
+ fIndex = index;
+ fFlatSize = size;
+ fChecksum = SkChecksum::Compute(this->data32(), size);
+ this->setTopBotUnwritten();
+ this->setSentinelAsCandidate();
+}
+
SkFlatData* SkFlatData::Create(SkFlatController* controller, const void* obj,
int index, void (*flattenProc)(SkOrderedWriteBuffer&, const void*)) {
// a buffer of 256 bytes should be sufficient for most paints, regions,
@@ -119,14 +127,9 @@ SkFlatData* SkFlatData::Create(SkFlatController* controller, const void* obj,
size_t allocSize = sizeof(SkFlatData) + size + sizeof(uint32_t);
SkFlatData* result = (SkFlatData*) controller->allocThrow(allocSize);
- result->setIndex(index);
- result->setTopBotUnwritten();
- result->fFlatSize = size;
-
// put the serialized contents into the data section of the new allocation
buffer.writeToMemory(result->data());
- result->fChecksum = SkChecksum::Compute(result->data32(), size);
- result->setSentinelAsCandidate();
+ result->stampHeaderAndSentinel(index, size);
return result;
}
« src/core/SkPictureFlat.h ('K') | « src/core/SkPictureFlat.h ('k') | tests/Writer32Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698