Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2097)

Side by Side Diff: tests/RecordTestUtils.h

Issue 1461663003: Add SkRecord::defrag(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/RecordTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « tests/RecordTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698