| 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 #include "Test.h" | 8 #include "Test.h" |
| 9 | 9 |
| 10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |