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

Side by Side 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, 11 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 unified diff | Download patch
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | tests/BitmapHeapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (!mustKeep) { 143 if (!mustKeep) {
144 return potential; 144 return potential;
145 } 145 }
146 } 146 }
147 } 147 }
148 return NULL; 148 return NULL;
149 } 149 }
150 150
151 /////////////////////////////////////////////////////////////////////////////// 151 ///////////////////////////////////////////////////////////////////////////////
152 152
153 class FlatDictionary : public SkFlatDictionary<SkFlattenable> { 153 struct SkFlattenableTraits {
154 public: 154 static void flatten(SkOrderedWriteBuffer& buffer, const SkFlattenable& flatt enable) {
155 FlatDictionary(FlattenableHeap* heap) 155 buffer.writeFlattenable(&flattenable);
156 : SkFlatDictionary<SkFlattenable>(heap) {
157 fFlattenProc = &flattenFlattenableProc;
158 // No need to define fUnflattenProc since the writer will never
159 // unflatten the data.
160 } 156 }
161 static void flattenFlattenableProc(SkOrderedWriteBuffer& buffer, 157 // No need to define unflatten if we never call it.
162 const void* obj) {
163 buffer.writeFlattenable((SkFlattenable*)obj);
164 }
165
166 }; 158 };
159 typedef SkFlatDictionary<SkFlattenable, SkFlattenableTraits> FlatDictionary;
167 160
168 /////////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////////
169 162
170 /** 163 /**
171 * If SkBitmaps are to be flattened to send to the reader, this class is 164 * If SkBitmaps are to be flattened to send to the reader, this class is
172 * provided to the SkBitmapHeap to tell the SkGPipeCanvas to do so. 165 * provided to the SkBitmapHeap to tell the SkGPipeCanvas to do so.
173 */ 166 */
174 class BitmapShuttle : public SkBitmapHeap::ExternalStorage { 167 class BitmapShuttle : public SkBitmapHeap::ExternalStorage {
175 public: 168 public:
176 BitmapShuttle(SkGPipeCanvas*); 169 BitmapShuttle(SkGPipeCanvas*);
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 return fCanvas->shuttleBitmap(bitmap, slot); 1233 return fCanvas->shuttleBitmap(bitmap, slot);
1241 } 1234 }
1242 1235
1243 void BitmapShuttle::removeCanvas() { 1236 void BitmapShuttle::removeCanvas() {
1244 if (NULL == fCanvas) { 1237 if (NULL == fCanvas) {
1245 return; 1238 return;
1246 } 1239 }
1247 fCanvas->unref(); 1240 fCanvas->unref();
1248 fCanvas = NULL; 1241 fCanvas = NULL;
1249 } 1242 }
OLDNEW
« 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