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

Unified Diff: src/pipe/SkGPipeWrite.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/SkPicturePlayback.cpp ('k') | tests/BitmapHeapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 0131ebb8764306520dabac25598078705b9dad1c..68acc179e766c5c19abc9840a3a99d82a76e3a0f 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -150,20 +150,13 @@ const SkFlatData* FlattenableHeap::flatToReplace() const {
///////////////////////////////////////////////////////////////////////////////
-class FlatDictionary : public SkFlatDictionary<SkFlattenable> {
-public:
- FlatDictionary(FlattenableHeap* heap)
- : SkFlatDictionary<SkFlattenable>(heap) {
- fFlattenProc = &flattenFlattenableProc;
- // No need to define fUnflattenProc since the writer will never
- // unflatten the data.
- }
- static void flattenFlattenableProc(SkOrderedWriteBuffer& buffer,
- const void* obj) {
- buffer.writeFlattenable((SkFlattenable*)obj);
+struct SkFlattenableTraits {
+ static void flatten(SkOrderedWriteBuffer& buffer, const SkFlattenable& flattenable) {
+ buffer.writeFlattenable(&flattenable);
}
-
+ // No need to define unflatten if we never call it.
};
+typedef SkFlatDictionary<SkFlattenable, SkFlattenableTraits> FlatDictionary;
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | tests/BitmapHeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698