-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios_platform_view] more precision when determine if a clip rrect is necessary #38965
[ios_platform_view] more precision when determine if a clip rrect is necessary #38965
Conversation
d8b5fe9 to
bd92e72
Compare
| bounding_rect, transformMatrix)) { | ||
| break; | ||
| } | ||
| // TODO(cyanglaz): Find a way to pre-determine if path contains the PlatformView boudning |
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.
this is probably a hard geometry problem. but i bet most clipping actions are just simple shapes like RRect
| {transformed_lower_right_x, transformed_lower_right_y}, | ||
| {transformed_lower_left_x, transformed_lower_left_y}}; | ||
| transformed_rrect.setRectRadii(transformed_clip_rect, corners); | ||
| return transformed_rrect.contains(platformview_boundingrect); |
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.
i assume this contains actually take its radii into consideration (rather than just checking rectangular bounds)?
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.
Yep, it does. the new scenario app test covers it. The new unit test also covered it. I had to use (-1, -1) as the origin for the clipRRect with a 1 radius to avoid clipping the PlatformView at (0, 0) origin.
Currently, the clipRRect's bounding rect is used to determine if the clipRRect operation is necessary on PlatformView. (See #37434) This causes a bug when the bounding rect is not clipping the PlatformView but the corner radii are.
This PR uses the whole rrect to determine if the clip operation is necessary.
To prevent similar regression, this PR also removed the similar buggy logic for clipPath. clipPath is not as trival, a TODO is added and I should cycle back to work on clipPath later.
fixes flutter/flutter#118550
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.