OLD | NEW |
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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // SkRecord often looks like it's compatible with any type T, but really it's co
mpatible with any | 23 // 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 | 24 // 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 | 25 // only with SkRecords::* structs defined in SkRecords.h. Your compiler will he
lpfully yell if you |
26 // get this wrong. | 26 // get this wrong. |
27 | 27 |
28 class SkRecord : public SkNVRefCnt<SkRecord> { | 28 class SkRecord : public SkNVRefCnt<SkRecord> { |
29 enum { | 29 enum { |
30 kFirstReserveCount = 64 / sizeof(void*), | 30 kFirstReserveCount = 64 / sizeof(void*), |
31 }; | 31 }; |
32 public: | 32 public: |
33 SkRecord() : fCount(0), fReserved(0) {} | 33 SkRecord() : fCount(0), fReserved(0), fAlloc(8/*start block sizes at 256 byt
es*/) {} |
34 ~SkRecord(); | 34 ~SkRecord(); |
35 | 35 |
36 // Returns the number of canvas commands in this SkRecord. | 36 // Returns the number of canvas commands in this SkRecord. |
37 unsigned count() const { return fCount; } | 37 unsigned count() const { return fCount; } |
38 | 38 |
39 // Visit the i-th canvas command with a functor matching this interface: | 39 // Visit the i-th canvas command with a functor matching this interface: |
40 // template <typename T> | 40 // template <typename T> |
41 // R operator()(const T& record) { ... } | 41 // R operator()(const T& record) { ... } |
42 // This operator() must be defined for at least all SkRecords::*. | 42 // This operator() must be defined for at least all SkRecords::*. |
43 template <typename R, typename F> | 43 template <typename R, typename F> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 unsigned fReserved; | 228 unsigned fReserved; |
229 SkAutoTMalloc<Record> fRecords; | 229 SkAutoTMalloc<Record> fRecords; |
230 SkAutoTMalloc<Type8> fTypes; | 230 SkAutoTMalloc<Type8> fTypes; |
231 SkVarAlloc fAlloc; | 231 SkVarAlloc fAlloc; |
232 // Strangely the order of these fields matters. If the unsigneds don't go f
irst we're 56 bytes. | 232 // Strangely the order of these fields matters. If the unsigneds don't go f
irst we're 56 bytes. |
233 // tomhudson and mtklein have no idea why. | 233 // tomhudson and mtklein have no idea why. |
234 }; | 234 }; |
235 SK_COMPILE_ASSERT(sizeof(SkRecord) <= 56, SkRecordSize); | 235 SK_COMPILE_ASSERT(sizeof(SkRecord) <= 56, SkRecordSize); |
236 | 236 |
237 #endif//SkRecord_DEFINED | 237 #endif//SkRecord_DEFINED |
OLD | NEW |