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

Side by Side Diff: src/core/SkRecordPattern.h

Issue 835973005: Fold alpha to the inner savelayer in savelayer-savelayer-restore patterns (Closed) Base URL: https://skia.googlesource.com/skia.git@record-opt-savelayer-draw-non-opaque
Patch Set: remove one too many inttoscalar Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/core/SkRecordOpts.cpp ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef SkRecordPattern_DEFINED 1 #ifndef SkRecordPattern_DEFINED
2 #define SkRecordPattern_DEFINED 2 #define SkRecordPattern_DEFINED
3 3
4 #include "SkTLogic.h" 4 #include "SkTLogic.h"
5 5
6 namespace SkRecords { 6 namespace SkRecords {
7 7
8 // First, some matchers. These match a single command in the SkRecord, 8 // First, some matchers. These match a single command in the SkRecord,
9 // and may hang onto some data from it. If so, you can get the data by calling .get(). 9 // and may hang onto some data from it. If so, you can get the data by calling .get().
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 return false; 126 return false;
127 } 127 }
128 128
129 // Once either match or search has succeeded, access the stored data of the first, second, 129 // Once either match or search has succeeded, access the stored data of the first, second,
130 // or third matcher in this pattern. Add as needed for longer patterns. 130 // or third matcher in this pattern. Add as needed for longer patterns.
131 // T is checked statically at compile time; no casting is involved. It's ju st an API wart. 131 // T is checked statically at compile time; no casting is involved. It's ju st an API wart.
132 template <typename T> T* first() { return fHead.get(); } 132 template <typename T> T* first() { return fHead.get(); }
133 template <typename T> T* second() { return fTail.fHead.get(); } 133 template <typename T> T* second() { return fTail.fHead.get(); }
134 template <typename T> T* third() { return fTail.fTail.fHead.get(); } 134 template <typename T> T* third() { return fTail.fTail.fHead.get(); }
135 template <typename T> T* fourth() { return fTail.fTail.fTail.fHead.get(); }
135 136
136 private: 137 private:
137 // If head isn't a Star, try to match at i once. 138 // If head isn't a Star, try to match at i once.
138 template <typename T> 139 template <typename T>
139 unsigned matchHead(T*, SkRecord* record, unsigned i) { 140 unsigned matchHead(T*, SkRecord* record, unsigned i) {
140 if (i < record->count()) { 141 if (i < record->count()) {
141 if (record->mutate<bool>(i, fHead)) { 142 if (record->mutate<bool>(i, fHead)) {
142 return i+1; 143 return i+1;
143 } 144 }
144 } 145 }
(...skipping 30 matching lines...) Expand all
175 // All types A, B, C, ... are Matchers. 176 // All types A, B, C, ... are Matchers.
176 template <typename A> 177 template <typename A>
177 struct Pattern1 : Cons<A, Nil> {}; 178 struct Pattern1 : Cons<A, Nil> {};
178 179
179 template <typename A, typename B> 180 template <typename A, typename B>
180 struct Pattern2 : Cons<A, Pattern1<B> > {}; 181 struct Pattern2 : Cons<A, Pattern1<B> > {};
181 182
182 template <typename A, typename B, typename C> 183 template <typename A, typename B, typename C>
183 struct Pattern3 : Cons<A, Pattern2<B, C> > {}; 184 struct Pattern3 : Cons<A, Pattern2<B, C> > {};
184 185
186 template <typename A, typename B, typename C, typename D>
187 struct Pattern4 : Cons<A, Pattern3<B, C, D> > {};
188
189 template <typename A, typename B, typename C, typename D, typename E>
190 struct Pattern5 : Cons<A, Pattern4<B, C, D, E> > {};
191
192 template <typename A, typename B, typename C, typename D, typename E, typename F >
193 struct Pattern6 : Cons<A, Pattern5<B, C, D, E, F> > {};
194
195 template <typename A, typename B, typename C, typename D, typename E, typename F , typename G>
196 struct Pattern7 : Cons<A, Pattern6<B, C, D, E, F, G> > {};
197
185 } // namespace SkRecords 198 } // namespace SkRecords
186 199
187 #endif//SkRecordPattern_DEFINED 200 #endif//SkRecordPattern_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkRecordOpts.cpp ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698