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

Unified Diff: tests/RecordCullingTest.cpp

Issue 245853002: Refactor SkRecord opts, converting playback optimizations where possible. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: apply 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/record/SkRecords.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordCullingTest.cpp
diff --git a/tests/RecordCullingTest.cpp b/tests/RecordCullingTest.cpp
index 982fbe79388680559780f4c3a19c78adea0a233f..7cb62414c319d6dd14e8178128a7279dc4271af8 100644
--- a/tests/RecordCullingTest.cpp
+++ b/tests/RecordCullingTest.cpp
@@ -12,14 +12,20 @@
#include "SkRecorder.h"
#include "SkRecords.h"
-struct PushCullScanner {
+struct SkipScanner {
template <typename T> void operator()(const T&) {}
- SkTDArray<unsigned> fPopOffsets;
+ void apply(const SkRecord& record) {
+ for (unsigned i = 0; i < record.count(); i++) {
+ record.visit(i, *this);
+ }
+ }
+
+ SkTDArray<unsigned> fSkips;
};
-template <> void PushCullScanner::operator()(const SkRecords::PushCull& record) {
- *fPopOffsets.append() = record.popOffset;
+template <> void SkipScanner::operator()(const SkRecords::PairedPushCull& r) {
+ *fSkips.append() = r.skip;
}
@@ -39,10 +45,10 @@ DEF_TEST(RecordCulling, r) {
SkRecordAnnotateCullingPairs(&record);
- PushCullScanner scan;
- record.visit(scan);
+ SkipScanner scan;
+ scan.apply(record);
- REPORTER_ASSERT(r, 2 == scan.fPopOffsets.count());
- REPORTER_ASSERT(r, 6 == scan.fPopOffsets[0]);
- REPORTER_ASSERT(r, 2 == scan.fPopOffsets[1]);
+ REPORTER_ASSERT(r, 2 == scan.fSkips.count());
+ REPORTER_ASSERT(r, 6 == scan.fSkips[0]);
+ REPORTER_ASSERT(r, 2 == scan.fSkips[1]);
}
« 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