diff options
author | 2014-05-06 21:32:19 +0000 | |
---|---|---|
committer | 2014-05-06 21:32:19 +0000 | |
commit | 1b546462bb91e93cf2f033eb2dab53ec492b64ab (patch) | |
tree | fa6303ceea45f6e23e6ad272790b395c0e835300 | |
parent | 95b03ce59986ecee5e4188da630a563efca3afe8 (diff) |
SaveLayer is not a draw.
Will keep thinking about the best way to handle this:
- leave as-is
- tag the records
- some range check on T::kType
- just list all Draw* in IsDraw
BUG=skia:2378
R=fmalita@chromium.org, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/269543023
git-svn-id: http://skia.googlecode.com/svn/trunk@14602 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/record/SkRecordPattern.h | 6 | ||||
-rw-r--r-- | tests/RecordPatternTest.cpp | 10 |
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)); +} |