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

Unified Diff: src/core/SkPictureFlat.cpp

Issue 21564008: use SkTDynamicHash in picture recording (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: er, actually, the remove i removed was necessary Created 7 years, 4 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 | « src/core/SkPictureFlat.h ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureFlat.cpp
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index 2c6efa2a8fd39ed39d4430629f7dc19958c17f0b..2a7d15a7b4cf9f79bfd862847c5db5a36708565a 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -94,16 +94,10 @@ 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*)) {
+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,
// and matrices.
intptr_t storage[256];
@@ -118,18 +112,14 @@ SkFlatData* SkFlatData::Create(SkFlatController* controller, const void* obj,
uint32_t size = buffer.size();
SkASSERT(SkIsAlign4(size));
- /**
- * Allocate enough memory to hold
- * 1. SkFlatData struct
- * 2. flattenProc's data (4-byte aligned)
- * 3. 4-byte sentinel
- */
- size_t allocSize = sizeof(SkFlatData) + size + sizeof(uint32_t);
+ // Allocate enough memory to hold SkFlatData struct and the flat data itself.
+ size_t allocSize = sizeof(SkFlatData) + size;
SkFlatData* result = (SkFlatData*) controller->allocThrow(allocSize);
- // put the serialized contents into the data section of the new allocation
+ // Put the serialized contents into the data section of the new allocation.
buffer.writeToMemory(result->data());
- result->stampHeaderAndSentinel(index, size);
+ // Stamp the index, size and checksum in the header.
+ result->stampHeader(index, size);
return result;
}
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698