OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 RecordTestUtils_DEFINED | 8 #ifndef RecordTestUtils_DEFINED |
9 #define RecordTestUtils_DEFINED | 9 #define RecordTestUtils_DEFINED |
10 | 10 |
11 #include "SkRecord.h" | 11 #include "SkRecord.h" |
12 #include "SkRecords.h" | 12 #include "SkRecords.h" |
| 13 #include "Test.h" |
13 | 14 |
14 // If the command we're reading is a U, set ptr to it, otherwise set it to nullp
tr. | 15 // If the command we're reading is a U, set ptr to it, otherwise set it to nullp
tr. |
15 template <typename U> | 16 template <typename U> |
16 struct ReadAs { | 17 struct ReadAs { |
17 ReadAs() : ptr(nullptr), type(SkRecords::Type(~0)) {} | 18 ReadAs() : ptr(nullptr), type(SkRecords::Type(~0)) {} |
18 | 19 |
19 const U* ptr; | 20 const U* ptr; |
20 SkRecords::Type type; | 21 SkRecords::Type type; |
21 | 22 |
22 void operator()(const U& r) { ptr = &r; type = U::kType; } | 23 void operator()(const U& r) { ptr = &r; type = U::kType; } |
(...skipping 30 matching lines...) Expand all Loading... |
53 MatchType<DrawT> matcher; | 54 MatchType<DrawT> matcher; |
54 for (int i = 0; i < record.count(); i++) { | 55 for (int i = 0; i < record.count(); i++) { |
55 if (record.visit<int>(i, matcher)) { | 56 if (record.visit<int>(i, matcher)) { |
56 return i; | 57 return i; |
57 } | 58 } |
58 } | 59 } |
59 return -1; | 60 return -1; |
60 } | 61 } |
61 | 62 |
62 #endif//RecordTestUtils_DEFINED | 63 #endif//RecordTestUtils_DEFINED |
OLD | NEW |