-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Engine] RSuperellipse.contains that reuses C++ implementation #164857
base: master
Are you sure you want to change the base?
Conversation
@jonahwilliams Can you take a look and see if this approach is acceptable? |
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'm not really convinced that subpixel accuracy is necessary for accurate hit testing (which already has a slop of 8-16 px) compared to the rrect approximation.
I agree, so I might not apply this to the clipping. However the ability to convert RSE to paths is crucial (such as to create a corresponding class of RoundedRectangleBorder) and we need this FFI to achieve this. This PR is mostly a baby step before the path changes. |
If you're converting the RSE paths then you're essentially falling back to the RRect or bezier approximation, which seems to defeat the purpose of a high fidelity backend implementation. If that is an acceptable trade off, then you should instead perform the bezier approximation in the framework and remove the engine specific API. Can we instead adjust the API in the framework where needed to support more than Paths? |
The path is used in I'll investigate whether I can deprecate these methods. Meanwhile I'm closing this PR for now. |
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@jonahwilliams I've searched Therefore I think we should move ahead with the path implementation and seek to perform the refactor in a separate project. |
Lets talk about this one tomorrow too. I have more questions, it will probably be faster to chat in person. |
KK so I did some profiling of figma_squircle and ... I can't say its any slower? If anything it can be a bit faster on older hardware, possibly because the RSE tessellator is generating more geometry (though I'd need to investigate it). So If there are no performance issues, its fine to use the bezier appromination - and the RSE geom can just be a specialization of that. So no changes needed for this PR @dkwingsmt , beyond review feedback |
Thank you! I'll take a look at the comments. |
I've significantly changed and simplified the design.
|
This PR implements
RSuperellipse.contains
. Different from the previous attempt #164517, this PR leverages the existing C++ implementation via FFI.The biggest outcome of this PR is to enable future work that generates RSE paths in the framework.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.