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

Unified Diff: tests/RecordTest.cpp

Issue 273643007: Convert all SkRecordPattern matchers into SkRecord mutators. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dumper too Created 6 years, 7 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 | « tests/RecordOptsTest.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordTest.cpp
diff --git a/tests/RecordTest.cpp b/tests/RecordTest.cpp
index e58ef10ddac457153e272529427cab383361f787..9238d97aa7606d08b11781911ff4255e59b45f3f 100644
--- a/tests/RecordTest.cpp
+++ b/tests/RecordTest.cpp
@@ -17,35 +17,36 @@ public:
template <typename T> void operator()(const T&) { }
+ void operator()(const SkRecords::DrawRect& draw) {
+ fArea += (int)(draw.rect.width() * draw.rect.height());
+ }
+
int area() const { return fArea; }
void apply(const SkRecord& record) {
for (unsigned i = 0; i < record.count(); i++) {
- record.visit(i, *this);
+ record.visit<void>(i, *this);
}
}
private:
int fArea;
};
-template <> void AreaSummer::operator()(const SkRecords::DrawRect& record) {
- fArea += (int) (record.rect.width() * record.rect.height());
-}
// Scales out the bottom-right corner of any DrawRect command it sees by 2x.
struct Stretch {
template <typename T> void operator()(T*) {}
+ void operator()(SkRecords::DrawRect* draw) {
+ draw->rect.fRight *= 2;
+ draw->rect.fBottom *= 2;
+ }
void apply(SkRecord* record) {
for (unsigned i = 0; i < record->count(); i++) {
- record->mutate(i, *this);
+ record->mutate<void>(i, *this);
}
}
};
-template <> void Stretch::operator()(SkRecords::DrawRect* record) {
- record->rect.fRight *= 2;
- record->rect.fBottom *= 2;
-}
// Basic tests for the low-level SkRecord code.
DEF_TEST(Record, r) {
« no previous file with comments | « tests/RecordOptsTest.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698