diff options
author | 2014-09-10 16:08:27 -0700 | |
---|---|---|
committer | 2014-09-10 16:08:28 -0700 | |
commit | 99d6a9ee8b3516de892d118c71aa5e6e5c865efd (patch) | |
tree | db1f93c0fb435d1eac274d302d65eac45a9abf88 /tests/RecordOptsTest.cpp | |
parent | f91c47d91d72a1d85e2d6701864b8d7accc81647 (diff) |
Fix a bug in Save-Restore no-op optimization.
We optimize
Save
SaveLayer
Restore
Restore
into
NoOp
NoOp
NoOp
Restore
I'm considering skipping the call to SkRecordOptimize again just to eliminate
this extra variable from landing SkRecord. Thoughts?
BUG=skia:
R=robertphillips@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/560163002
Diffstat (limited to 'tests/RecordOptsTest.cpp')
-rw-r--r-- | tests/RecordOptsTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp index dca9482197..e17b5e6bfa 100644 --- a/tests/RecordOptsTest.cpp +++ b/tests/RecordOptsTest.cpp @@ -99,6 +99,23 @@ DEF_TEST(RecordOpts_NoopSaveRestores, r) { } } +DEF_TEST(RecordOpts_SaveSaveLayerRestoreRestore, r) { + SkRecord record; + SkRecorder recorder(&record, W, H); + + // A previous bug NoOp'd away the first 3 commands. + recorder.save(); + recorder.saveLayer(NULL, NULL); + recorder.restore(); + recorder.restore(); + + SkRecordNoopSaveRestores(&record); + assert_type<SkRecords::Save> (r, record, 0); + assert_type<SkRecords::SaveLayer>(r, record, 1); + assert_type<SkRecords::Restore> (r, record, 2); + assert_type<SkRecords::Restore> (r, record, 3); +} + static void assert_savelayer_restore(skiatest::Reporter* r, SkRecord* record, unsigned i, |