From 1e44730ade943bba928f289ce9f59430c50c71e5 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 8 May 2014 18:17:51 +0000 Subject: 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 --- tests/RecordOptsTest.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/RecordOptsTest.cpp') 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(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(r, record, i); + } + assert_type(r, record, 4); + assert_type(r, record, 5); + assert_type(r, record, 6); + assert_type(r, record, 7); + assert_type(r, record, 8); +} + static void draw_pos_text(SkCanvas* canvas, const char* text, bool constantY) { const size_t len = strlen(text); SkAutoTMalloc pos(len); -- cgit v1.2.3