OLD | NEW |
(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 } |
OLD | NEW |