Skip to content

[Impeller] Add RoundSuperellipse class, containment check and stroking - #162826

Merged
auto-submit[bot] merged 16 commits into
flutter:masterfrom
dkwingsmt:rse-stroke
Feb 12, 2025
Merged

[Impeller] Add RoundSuperellipse class, containment check and stroking#162826
auto-submit[bot] merged 16 commits into
flutter:masterfrom
dkwingsmt:rse-stroke

Conversation

@dkwingsmt

@dkwingsmtdkwingsmt commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

This PR:

  • Adds a RoundSuperellipse class, which mirrors the current RoundRect class.
  • Implements RoundSuperellipse::Contains, which checks if a point is contained by the RSE.
  • Adds Path::AddSuperellipse, which draws an RSE with Bezier approximation.
  • Adds a RoundSuperellipseParam class, which is the common computation shared by geometry drawing, stroking, and containment check.
Screen.Recording.2025-02-10.at.4.04.24.PM.mp4

This PR also updates the RSE algorithm according to my recent research, which uses one fewer precomputed variable (no more d), shares the same gap factor with RRect, and allows much better precision. The result shape is almost unchanged (~0.2% slimmer).

For reviewers: The RoundSuperellipseParam and RoundSuperellipse::Contains parts are repurposed from the abandoned #162349. This PR is a preparation for #160883.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actionsgithub-actionsBot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Feb 6, 2025
@dkwingsmt
dkwingsmt requested a review from flarFebruary 11, 2025 00:14
@dkwingsmt
dkwingsmt marked this pull request as ready for review February 11, 2025 00:14
Comment threadengine/src/flutter/impeller/geometry/path_builder.cc Outdated
Comment threadengine/src/flutter/impeller/geometry/path_builder.cc Outdated
Comment threadengine/src/flutter/impeller/geometry/path_builder.cc Outdated
@dkwingsmt

Copy link
Copy Markdown
ContributorAuthor

@jonahwilliams Thanks for the great suggestions! All have been addressed.

@jonahwilliamsjonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, LGTM!

@dkwingsmtdkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 12, 2025
@auto-submit
auto-submitBot added this pull request to the merge queueFeb 12, 2025
Merged via the queue into flutter:master with commit ef927e8Feb 12, 2025
@flutter-dashboardflutter-dashboardBot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@dkwingsmt@jonahwilliams