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

Unified Diff: src/core/SkPictureFlat.cpp

Issue 123213004: Function pointers -> templates in SkPictureFlat. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: align storage Created 6 years, 12 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/SkPicturePlayback.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 149cf7cc02c01263e76943e26c4080099d8d347d..e75023e0f632feda3a6d19fd5e4528a7f8ee78c7 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -90,51 +90,3 @@ SkNamedFactorySet* SkFlatController::setNamedFactorySet(SkNamedFactorySet* set)
return set;
}
-///////////////////////////////////////////////////////////////////////////////
-
-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];
- SkOrderedWriteBuffer buffer(256, storage, sizeof(storage));
-
- buffer.setBitmapHeap(controller->getBitmapHeap());
- buffer.setTypefaceRecorder(controller->getTypefaceSet());
- buffer.setNamedFactoryRecorder(controller->getNamedFactorySet());
- buffer.setFlags(controller->getWriteBufferFlags());
-
- flattenProc(buffer, obj);
- uint32_t size = buffer.size();
- SkASSERT(SkIsAlign4(size));
-
- // 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.
- buffer.writeToMemory(result->data());
- // Stamp the index, size and checksum in the header.
- result->stampHeader(index, size);
- return result;
-}
-
-void SkFlatData::unflatten(void* result,
- void (*unflattenProc)(SkOrderedReadBuffer&, void*),
- SkBitmapHeap* bitmapHeap,
- SkTypefacePlayback* facePlayback) const {
-
- SkOrderedReadBuffer buffer(this->data(), fFlatSize);
-
- if (bitmapHeap) {
- buffer.setBitmapStorage(bitmapHeap);
- }
- if (facePlayback) {
- facePlayback->setupBuffer(buffer);
- }
-
- unflattenProc(buffer, result);
- SkASSERT(fFlatSize == (int32_t)buffer.offset());
-}
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698