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 SkRecords_DEFINED | 8 #ifndef SkRecords_DEFINED |
9 #define SkRecords_DEFINED | 9 #define SkRecords_DEFINED |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Defines SkRecords::Type, an enum of all record types. | 56 // Defines SkRecords::Type, an enum of all record types. |
57 #define ENUM(T) T##_Type, | 57 #define ENUM(T) T##_Type, |
58 enum Type { SK_RECORD_TYPES(ENUM) }; | 58 enum Type { SK_RECORD_TYPES(ENUM) }; |
59 #undef ENUM | 59 #undef ENUM |
60 | 60 |
61 // Macros to make it easier to define a record for a draw call with 0 args, 1 ar
gs, 2 args, etc. | 61 // Macros to make it easier to define a record for a draw call with 0 args, 1 ar
gs, 2 args, etc. |
62 // These should be clearer when you look at their use below. | 62 // These should be clearer when you look at their use below. |
63 #define RECORD0(T) \ | 63 #define RECORD0(T) \ |
64 struct T { \ | 64 struct T { \ |
65 static const Type kType = T##_Type; \ | 65 static const Type kType = T##_Type; \ |
| 66 T() {} \ |
66 }; | 67 }; |
67 | 68 |
68 // We try to be flexible about the types the constructors take. Instead of requ
ring the exact type | 69 // We try to be flexible about the types the constructors take. Instead of requ
ring the exact type |
69 // A here, we take any type Z which implicitly casts to A. This allows the dela
y_copy() trick to | 70 // A here, we take any type Z which implicitly casts to A. This allows the dela
y_copy() trick to |
70 // work, allowing the caller to decide whether to pass by value or by const&. | 71 // work, allowing the caller to decide whether to pass by value or by const&. |
71 | 72 |
72 #define RECORD1(T, A, a) \ | 73 #define RECORD1(T, A, a) \ |
73 struct T { \ | 74 struct T { \ |
74 static const Type kType = T##_Type; \ | 75 static const Type kType = T##_Type; \ |
75 template <typename Z> \ | 76 template <typename Z> \ |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 #undef RECORD0 | 279 #undef RECORD0 |
279 #undef RECORD1 | 280 #undef RECORD1 |
280 #undef RECORD2 | 281 #undef RECORD2 |
281 #undef RECORD3 | 282 #undef RECORD3 |
282 #undef RECORD4 | 283 #undef RECORD4 |
283 #undef RECORD5 | 284 #undef RECORD5 |
284 | 285 |
285 } // namespace SkRecords | 286 } // namespace SkRecords |
286 | 287 |
287 #endif//SkRecords_DEFINED | 288 #endif//SkRecords_DEFINED |
OLD | NEW |