DescriptionAdd pattern matchers for SkRecord
This is a mid-level library for finding patterns of commands in an SkRecord. At the API level, it's a bit regex inspired. Some examples:
- Pattern1<Is<DrawRect>> matches a single DrawRect
- Pattern1<Star<Is<DrawRect>>> matches 0 or more DrawRects
- Pattern2<Is<ClipRect>, Is<DrawRect>> matches a single clip rect followed by a single draw rect
- Pattern3<Is<Save>, Star<IsDraw>, Is<Restore>> matches a single Save, followed by any number of Draws, followed by Restore
- Pattern1<Or<Is<DrawRect>, Is<ClipRect>>> matches a DrawRect or a ClipRect
- Pattern1<Not<Is<ClipRect>>> matches a command that's notClipRect.
Once you have a pattern, you can call .search() on it to step through ranges of matching commands. This means patterns can replace most of the custom iteration logic for optimization passes: the generic pattern searching steps through all the optimization candidates, which optimization-specific code further inspects and mutates.
SkRecordTraits is now unused. Bye bye!
Generated code and performance of SkRecordOpts is very similar to what it was before. (I had to use SK_ALWAYS_INLINE in a few places to make this so.)
BUG=skia:2378
Committed: http://code.google.com/p/skia/source/detail?r=14582
Patch Set 1 #Patch Set 2 : bug #Patch Set 3 : new test #Patch Set 4 : always start from last end #Patch Set 5 : hammer SK_ALWAYS_INLINE until code generation looks good #Patch Set 6 : remove unused SkRecordTraits #Patch Set 7 : port opts where possible #Patch Set 8 : syntax sugar #Patch Set 9 : test and fix Star storage #Patch Set 10 : comments and refactoring #Patch Set 11 : rebase #Patch Set 12 : notes #Patch Set 13 : yet more notes #
Total comments: 2
Patch Set 14 : ben #
Total comments: 4
Patch Set 15 : fix comment #Patch Set 16 : init pointers #
Messages
Total messages: 13 (0 generated)
|