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

Side by Side Diff: src/core/SkRecord.h

Issue 364823009: Port suitableForGpuRasterization to SkRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More SkPicture.h cleanup Created 6 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 unified diff | Download patch
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordAnalysis.h » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkRecord_DEFINED 8 #ifndef SkRecord_DEFINED
9 #define SkRecord_DEFINED 9 #define SkRecord_DEFINED
10 10
11 #include "SkChunkAlloc.h" 11 #include "SkChunkAlloc.h"
12 #include "SkRecords.h" 12 #include "SkRecords.h"
13 #include "SkTLogic.h" 13 #include "SkTLogic.h"
14 #include "SkTemplates.h" 14 #include "SkTemplates.h"
15 15
16 struct SkRecordAnalysis {
17 SkRecordAnalysis()
18 : fWillPlaybackBitmaps(false)
19 , fSuitableForGpuRasterization(false) { }
20
21 bool fWillPlaybackBitmaps;
22 bool fSuitableForGpuRasterization;
23 };
24
16 // SkRecord (REC-ord) represents a sequence of SkCanvas calls, saved for future use. 25 // SkRecord (REC-ord) represents a sequence of SkCanvas calls, saved for future use.
17 // These future uses may include: replay, optimization, serialization, or combin ations of those. 26 // These future uses may include: replay, optimization, serialization, or combin ations of those.
18 // 27 //
19 // Though an enterprising user may find calling alloc(), append(), visit(), and mutate() enough to 28 // Though an enterprising user may find calling alloc(), append(), visit(), and mutate() enough to
20 // work with SkRecord, you probably want to look at SkRecorder which presents an SkCanvas interface 29 // work with SkRecord, you probably want to look at SkRecorder which presents an SkCanvas interface
21 // for creating an SkRecord, and SkRecordDraw which plays an SkRecord back into another SkCanvas. 30 // for creating an SkRecord, and SkRecordDraw which plays an SkRecord back into another SkCanvas.
22 // 31 //
23 // SkRecord often looks like it's compatible with any type T, but really it's co mpatible with any 32 // SkRecord often looks like it's compatible with any type T, but really it's co mpatible with any
24 // type T which has a static const SkRecords::Type kType. That is to say, SkRec ord is compatible 33 // type T which has a static const SkRecords::Type kType. That is to say, SkRec ord is compatible
25 // only with SkRecords::* structs defined in SkRecords.h. Your compiler will he lpfully yell if you 34 // only with SkRecords::* structs defined in SkRecords.h. Your compiler will he lpfully yell if you
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 T* replace(unsigned i, const SkRecords::Adopted<Existing>& proofOfAdoption) { 112 T* replace(unsigned i, const SkRecords::Adopted<Existing>& proofOfAdoption) {
104 SkASSERT(i < this->count()); 113 SkASSERT(i < this->count());
105 114
106 SkASSERT(Existing::kType == fTypes[i]); 115 SkASSERT(Existing::kType == fTypes[i]);
107 SkASSERT(proofOfAdoption == fRecords[i].ptr<Existing>()); 116 SkASSERT(proofOfAdoption == fRecords[i].ptr<Existing>());
108 117
109 fTypes[i] = T::kType; 118 fTypes[i] = T::kType;
110 return fRecords[i].set(this->allocCommand<T>()); 119 return fRecords[i].set(this->allocCommand<T>());
111 } 120 }
112 121
122 SkRecordAnalysis fAccelerationInfo;
mtklein 2014/08/18 16:34:58 Let's keep this parallel to SkRecord like fWillPla
tomhudson 2014/08/18 16:58:47 (This was intended to be a private member with acc
123
113 private: 124 private:
114 // Implementation notes! 125 // Implementation notes!
115 // 126 //
116 // Logically an SkRecord is structured as an array of pointers into a big ch unk of memory where 127 // Logically an SkRecord is structured as an array of pointers into a big ch unk of memory where
117 // records representing each canvas draw call are stored: 128 // records representing each canvas draw call are stored:
118 // 129 //
119 // fRecords: [*][*][*]... 130 // fRecords: [*][*][*]...
120 // | | | 131 // | | |
121 // | | | 132 // | | |
122 // | | +---------------------------------------+ 133 // | | +---------------------------------------+
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 SkChunkAlloc fAlloc; 236 SkChunkAlloc fAlloc;
226 SkAutoTMalloc<Record> fRecords; 237 SkAutoTMalloc<Record> fRecords;
227 SkAutoTMalloc<Type8> fTypes; 238 SkAutoTMalloc<Type8> fTypes;
228 // fCount and fReserved measure both fRecords and fTypes, which always grow in lock step. 239 // fCount and fReserved measure both fRecords and fTypes, which always grow in lock step.
229 unsigned fCount; 240 unsigned fCount;
230 unsigned fReserved; 241 unsigned fReserved;
231 const unsigned kFirstReserveCount; 242 const unsigned kFirstReserveCount;
232 }; 243 };
233 244
234 #endif//SkRecord_DEFINED 245 #endif//SkRecord_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordAnalysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698