-
Notifications
You must be signed in to change notification settings - Fork 6k
Refactor clip layers to share common code #32889
Refactor clip layers to share common code #32889
Conversation
f6672be to
1b177d6
Compare
flar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just formatting and a cleanup suggestion.
(Not sure if there is a way to macro-ify the sub-class names in the TRACE_EVENT strings at compile time to avoid the overrides, but also don't think it is worth it to try to do something that might impact the runtime for Release builds)
flar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Note that there is a slight behavior change for rect where it used to use the entire rect for the saveLayer and checkerboard, but now uses the clipped child bounds - as you discovered when you had to modify a test case. This should be a good thing and should be consistent across the clip types, but may cause some off-by-1 saveLayer anomalies and we'll have to be on the lookout for potential golden file changes down the line.
Added a new template class
ClipShapeLayerto share the common code of clip layers, which also fixes the issue thatClipRectLayeruses clip rect forsaveLayerbounds.fix flutter/flutter#102341
fix (Partially) flutter/flutter#70406 (This PR only refactors the clip layers, not the clip layers unit tests. I've tried refactoring those unit tests, but haven't found a good way to do that.)
Pre-launch Checklist
writing and running engine tests.
///).