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

Side by Side Diff: tests/RecordCullingTest.cpp

Issue 229523002: SkRecord: make culling work if SkRecordAnnotateCullingPairs is called. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 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 | « src/record/SkRecords.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "Test.h"
2
3 #include "SkRecord.h"
4 #include "SkRecordCulling.h"
5 #include "SkRecorder.h"
6 #include "SkRecords.h"
7
8 struct PushCullScanner {
9 template <typename T> void operator()(const T&) {}
10
11 SkTDArray<unsigned> fPopOffsets;
12 };
13
14 template <> void PushCullScanner::operator()(const SkRecords::PushCull& record) {
15 *fPopOffsets.append() = record.popOffset;
16 }
17
18
19 DEF_TEST(RecordCulling, r) {
20 SkRecord record;
21 SkRecorder recorder(&record, 1920, 1080);
22
23 recorder.drawRect(SkRect::MakeWH(1000, 10000), SkPaint());
24
25 recorder.pushCull(SkRect::MakeWH(100, 100));
26 recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
27 recorder.drawRect(SkRect::MakeWH(30, 30), SkPaint());
28 recorder.pushCull(SkRect::MakeWH(5, 5));
29 recorder.drawRect(SkRect::MakeWH(1, 1), SkPaint());
30 recorder.popCull();
31 recorder.popCull();
32
33 SkRecordAnnotateCullingPairs(&record);
34
35 PushCullScanner scan;
36 record.visit(scan);
37
38 REPORTER_ASSERT(r, 2 == scan.fPopOffsets.count());
39 REPORTER_ASSERT(r, 6 == scan.fPopOffsets[0]);
40 REPORTER_ASSERT(r, 2 == scan.fPopOffsets[1]);
41 }
OLDNEW
« no previous file with comments | « src/record/SkRecords.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698