diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-08 18:17:51 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-08 18:17:51 +0000 |
commit | 1e44730ade943bba928f289ce9f59430c50c71e5 (patch) | |
tree | 8f70b88820c15dff98c269e7e67dc71c4d5e6d10 /tests/RecordOptsTest.cpp | |
parent | e529a61dd416e454bd858ef948aa49f5b4e02b80 (diff) |
Noop away PushCull/PopCull pairs with nothing between them.
BUG=skia:2378
R=fmalita@chromium.org, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/277613002
git-svn-id: http://skia.googlecode.com/svn/trunk@14653 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/RecordOptsTest.cpp')
-rw-r--r-- | tests/RecordOptsTest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp index c427c25119..34229d7a6b 100644 --- a/tests/RecordOptsTest.cpp +++ b/tests/RecordOptsTest.cpp @@ -60,6 +60,35 @@ DEF_TEST(RecordOpts_Culling, r) { REPORTER_ASSERT(r, 2 == assert_type<SkRecords::PairedPushCull>(r, record, 4)->skip); } +DEF_TEST(RecordOpts_NoopCulls, r) { + SkRecord record; + SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H); + + // All should be nooped. + recorder.pushCull(SkRect::MakeWH(200, 200)); + recorder.pushCull(SkRect::MakeWH(100, 100)); + recorder.popCull(); + recorder.popCull(); + + // Kept for now. We could peel off a layer of culling. + recorder.pushCull(SkRect::MakeWH(5, 5)); + recorder.pushCull(SkRect::MakeWH(5, 5)); + recorder.drawRect(SkRect::MakeWH(1, 1), SkPaint()); + recorder.popCull(); + recorder.popCull(); + + SkRecordNoopCulls(&record); + + for (unsigned i = 0; i < 4; i++) { + assert_type<SkRecords::NoOp>(r, record, i); + } + assert_type<SkRecords::PushCull>(r, record, 4); + assert_type<SkRecords::PushCull>(r, record, 5); + assert_type<SkRecords::DrawRect>(r, record, 6); + assert_type<SkRecords::PopCull>(r, record, 7); + assert_type<SkRecords::PopCull>(r, record, 8); +} + static void draw_pos_text(SkCanvas* canvas, const char* text, bool constantY) { const size_t len = strlen(text); SkAutoTMalloc<SkPoint> pos(len); |