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() {} \ | |
67 }; | 66 }; |
68 | 67 |
69 // We try to be flexible about the types the constructors take. Instead of requ
ring the exact type | 68 // We try to be flexible about the types the constructors take. Instead of requ
ring the exact type |
70 // A here, we take any type Z which implicitly casts to A. This allows the dela
y_copy() trick to | 69 // A here, we take any type Z which implicitly casts to A. This allows the dela
y_copy() trick to |
71 // work, allowing the caller to decide whether to pass by value or by const&. | 70 // work, allowing the caller to decide whether to pass by value or by const&. |
72 | 71 |
73 #define RECORD1(T, A, a) \ | 72 #define RECORD1(T, A, a) \ |
74 struct T { \ | 73 struct T { \ |
75 static const Type kType = T##_Type; \ | 74 static const Type kType = T##_Type; \ |
76 template <typename Z> \ | 75 template <typename Z> \ |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 #undef RECORD0 | 278 #undef RECORD0 |
280 #undef RECORD1 | 279 #undef RECORD1 |
281 #undef RECORD2 | 280 #undef RECORD2 |
282 #undef RECORD3 | 281 #undef RECORD3 |
283 #undef RECORD4 | 282 #undef RECORD4 |
284 #undef RECORD5 | 283 #undef RECORD5 |
285 | 284 |
286 } // namespace SkRecords | 285 } // namespace SkRecords |
287 | 286 |
288 #endif//SkRecords_DEFINED | 287 #endif//SkRecords_DEFINED |
OLD | NEW |