aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/record/SkRecordPattern.h6
-rw-r--r--tests/RecordPatternTest.cpp10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/record/SkRecordPattern.h b/src/record/SkRecordPattern.h
index 2023a90572..c5d87f2a20 100644
--- a/src/record/SkRecordPattern.h
+++ b/src/record/SkRecordPattern.h
@@ -53,6 +53,12 @@ public:
return false;
}
+ // SaveLayer has an SkPaint named paint, but it's not a draw.
+ bool match(SaveLayer*) {
+ fPaint = NULL;
+ return false;
+ }
+
private:
// Abstracts away whether the paint is always part of the command or optional.
template <typename T> static T* AsPtr(SkRecords::Optional<T>& x) { return x; }
diff --git a/tests/RecordPatternTest.cpp b/tests/RecordPatternTest.cpp
index e013150072..4f51bdba24 100644
--- a/tests/RecordPatternTest.cpp
+++ b/tests/RecordPatternTest.cpp
@@ -190,3 +190,13 @@ DEF_TEST(RecordPattern_Complex, r) {
REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end));
}
+
+DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) {
+ Pattern1<IsDraw> pattern;
+
+ SkRecord record;
+ SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ recorder.saveLayer(NULL, NULL);
+
+ REPORTER_ASSERT(r, !pattern.match(&record, 0));
+}