| 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 | 13 |
| 14 // If the command we're reading is a U, set ptr to it, otherwise set it to NULL. | 14 // If the command we're reading is a U, set ptr to it, otherwise set it to nullp
tr. |
| 15 template <typename U> | 15 template <typename U> |
| 16 struct ReadAs { | 16 struct ReadAs { |
| 17 ReadAs() : ptr(NULL), type(SkRecords::Type(~0)) {} | 17 ReadAs() : ptr(nullptr), type(SkRecords::Type(~0)) {} |
| 18 | 18 |
| 19 const U* ptr; | 19 const U* ptr; |
| 20 SkRecords::Type type; | 20 SkRecords::Type type; |
| 21 | 21 |
| 22 void operator()(const U& r) { ptr = &r; type = U::kType; } | 22 void operator()(const U& r) { ptr = &r; type = U::kType; } |
| 23 | 23 |
| 24 template <typename T> | 24 template <typename T> |
| 25 void operator()(const T&) { type = U::kType; } | 25 void operator()(const T&) { type = U::kType; } |
| 26 }; | 26 }; |
| 27 | 27 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 MatchType<DrawT> matcher; | 53 MatchType<DrawT> matcher; |
| 54 for (int i = 0; i < record.count(); i++) { | 54 for (int i = 0; i < record.count(); i++) { |
| 55 if (record.visit<int>(i, matcher)) { | 55 if (record.visit<int>(i, matcher)) { |
| 56 return i; | 56 return i; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 return -1; | 59 return -1; |
| 60 } | 60 } |
| 61 | 61 |
| 62 #endif//RecordTestUtils_DEFINED | 62 #endif//RecordTestUtils_DEFINED |
| OLD | NEW |