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

Side by Side Diff: tests/RecorderTest.cpp

Issue 273643007: Convert all SkRecordPattern matchers into SkRecord mutators. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dumper too Created 6 years, 7 months 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') | tools/dump_record.cpp » ('j') | 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 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 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkRecord.h" 10 #include "SkRecord.h"
(...skipping 12 matching lines...) Expand all
23 Tally() { sk_bzero(&fHistogram, sizeof(fHistogram)); } 23 Tally() { sk_bzero(&fHistogram, sizeof(fHistogram)); }
24 24
25 template <typename T> 25 template <typename T>
26 void operator()(const T&) { ++fHistogram[T::kType]; } 26 void operator()(const T&) { ++fHistogram[T::kType]; }
27 27
28 template <typename T> 28 template <typename T>
29 int count() const { return fHistogram[T::kType]; } 29 int count() const { return fHistogram[T::kType]; }
30 30
31 void apply(const SkRecord& record) { 31 void apply(const SkRecord& record) {
32 for (unsigned i = 0; i < record.count(); i++) { 32 for (unsigned i = 0; i < record.count(); i++) {
33 record.visit(i, *this); 33 record.visit<void>(i, *this);
34 } 34 }
35 } 35 }
36 36
37 private: 37 private:
38 int fHistogram[kRecordTypes]; 38 int fHistogram[kRecordTypes];
39 }; 39 };
40 40
41 DEF_TEST(Recorder, r) { 41 DEF_TEST(Recorder, r) {
42 SkRecord record; 42 SkRecord record;
43 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080); 43 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080);
(...skipping 17 matching lines...) Expand all
61 61
62 REPORTER_ASSERT(r, paint.getShader()->unique()); 62 REPORTER_ASSERT(r, paint.getShader()->unique());
63 { 63 {
64 SkRecord record; 64 SkRecord record;
65 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080); 65 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080);
66 recorder.saveLayer(&bounds, &paint); 66 recorder.saveLayer(&bounds, &paint);
67 REPORTER_ASSERT(r, !paint.getShader()->unique()); 67 REPORTER_ASSERT(r, !paint.getShader()->unique());
68 } 68 }
69 REPORTER_ASSERT(r, paint.getShader()->unique()); 69 REPORTER_ASSERT(r, paint.getShader()->unique());
70 } 70 }
OLDNEW
« no previous file with comments | « tests/RecordTest.cpp ('k') | tools/dump_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698