aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkRecordOpts.cpp4
-rw-r--r--src/core/SkRecordPattern.h4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 3302d0cb4d..47718e102c 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -55,8 +55,10 @@ struct SaveOnlyDrawsRestoreNooper {
// Turns logical no-op Save-[non-drawing command]*-Restore patterns into actual no-ops.
struct SaveNoDrawsRestoreNooper {
// Star matches greedily, so we also have to exclude Save and Restore.
+ // Nested SaveLayers need to be excluded, or we'll match their Restore!
typedef Pattern3<Is<Save>,
- Star<Not<Or3<Is<Save>,
+ Star<Not<Or4<Is<Save>,
+ Is<SaveLayer>,
Is<Restore>,
IsDraw> > >,
Is<Restore> >
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index 57779ffd76..68a3aa315e 100644
--- a/src/core/SkRecordPattern.h
+++ b/src/core/SkRecordPattern.h
@@ -85,6 +85,10 @@ struct Or {
template <typename A, typename B, typename C>
struct Or3 : Or<A, Or<B, C> > {};
+// Matches if any of A, B, C or D does. Stores nothing.
+template <typename A, typename B, typename C, typename D>
+struct Or4 : Or<A, Or<B, Or<C, D> > > {};
+
// Star is a special matcher that greedily matches Matcher 0 or more times. Stores nothing.
template <typename Matcher>
struct Star {