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

Side by Side Diff: tests/RecordOptsTest.cpp

Issue 269543025: Partially restore small-T optimization for very small (empty) T. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 17 matching lines...) Expand all
28 void operator()(const T&) { *ptr = NULL; type = U::kType; } 28 void operator()(const T&) { *ptr = NULL; type = U::kType; }
29 }; 29 };
30 30
31 // Assert that the ith command in record is of type T, and return it. 31 // Assert that the ith command in record is of type T, and return it.
32 template <typename T> 32 template <typename T>
33 static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsig ned index) { 33 static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsig ned index) {
34 const T* ptr = NULL; 34 const T* ptr = NULL;
35 ReadAs<T> reader(&ptr); 35 ReadAs<T> reader(&ptr);
36 record.visit(index, reader); 36 record.visit(index, reader);
37 REPORTER_ASSERT(r, T::kType == reader.type); 37 REPORTER_ASSERT(r, T::kType == reader.type);
38 REPORTER_ASSERT(r, ptr != NULL);
39 return ptr; 38 return ptr;
40 } 39 }
41 40
42 DEF_TEST(RecordOpts_Culling, r) { 41 DEF_TEST(RecordOpts_Culling, r) {
43 SkRecord record; 42 SkRecord record;
44 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H); 43 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
45 44
46 recorder.drawRect(SkRect::MakeWH(1000, 10000), SkPaint()); 45 recorder.drawRect(SkRect::MakeWH(1000, 10000), SkPaint());
47 46
48 recorder.pushCull(SkRect::MakeWH(100, 100)); 47 recorder.pushCull(SkRect::MakeWH(100, 100));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 SkRecordNoopSaveRestores(&record); 144 SkRecordNoopSaveRestores(&record);
146 145
147 for (unsigned index = 0; index < 8; index++) { 146 for (unsigned index = 0; index < 8; index++) {
148 assert_type<SkRecords::NoOp>(r, record, index); 147 assert_type<SkRecords::NoOp>(r, record, index);
149 } 148 }
150 assert_type<SkRecords::Save>(r, record, 8); 149 assert_type<SkRecords::Save>(r, record, 8);
151 assert_type<SkRecords::DrawRect>(r, record, 9); 150 assert_type<SkRecords::DrawRect>(r, record, 9);
152 assert_type<SkRecords::Restore>(r, record, 10); 151 assert_type<SkRecords::Restore>(r, record, 10);
153 } 152 }
OLDNEW
« src/record/SkRecord.h ('K') | « src/record/SkRecord.h ('k') | tests/RecordPatternTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698