Skip to content

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Jul 2, 2025

This PR adds RSuperellipse support to Web, so that these ops will actually draw RSuperellipses instead of falling back to RRects, except for platform views.

  • (I was told in some earlier comments that RSuperellipses should fall back to RRects for platform views but I can't remember where for now. If reviewers think otherwise I can implement them right away or make this a TODO in the future.)

The RSuperellipses are drawn after being converted to paths. The algorithm is nothing new, but already used in round_superellipse_param.cc.

For performance optimization, RSuperellipses that have uniform radii will have their paths cached in a global cache after offset normalization.

This PR does not add any new public APIs. (Although, I'm planning to also implement this to the main dart:ui in the future to support non-Impeller-nor-Web platforms, which will need RSuperellipse.toPathOffset public.)

Fixes #163718

Pre-launch Checklist

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

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. f: cupertino flutter/packages/flutter/cupertino repository platform-web Web applications specifically f: material design flutter/packages/flutter/material repository. d: docs/ flutter/flutter/docs, for contributors and removed framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. f: cupertino flutter/packages/flutter/cupertino repository labels Jul 2, 2025
@dkwingsmt dkwingsmt requested review from mdebbar and yjbanov July 9, 2025 00:41
@mdebbar mdebbar requested a review from eyebrowsoffire July 10, 2025 15:40
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

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

LGTM! One nitpick

checkPointWithOffset(rse, const Offset(49.70, 49.70), const Offset(0.02, 0.02));

// Checks two points symmetrical to the origin.
void checkDiagnalPoints(Offset p) {
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling: checkDiagonalPoints

@github-actions github-actions bot added the e: impeller Impeller rendering backend issues and features requests label Jul 12, 2025
@dkwingsmt dkwingsmt force-pushed the rse-web-global-cache branch from 329d894 to 0426591 Compare July 12, 2025 00:12
@github-actions github-actions bot removed the d: docs/ flutter/flutter/docs, for contributors label Jul 12, 2025
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #171489 at sha 0426591

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Jul 12, 2025
@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 12, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 12, 2025
Merged via the queue into flutter:master with commit dcae0c4 Jul 12, 2025
180 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 12, 2025
Roll Flutter from 43657f3baa17 to 35f197f1e5f5 (39 revisions)

flutter/flutter@43657f3...35f197f

2025-07-12 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 8aoEy1hp2a9HI1pt-... to xQlbHCUI33kDvkew8... (flutter/flutter#172060)
2025-07-12 dkwingsmt@users.noreply.github.com Add RSuperellipse support to Web (global cache) (flutter/flutter#171489)
2025-07-12 87506348+jingshao-code@users.noreply.github.com Fix grammar: Change 'A' to 'An' before IOSSystemContextMenuItemData (flutter/flutter#172019)
2025-07-11 jason-simmons@users.noreply.github.com Manual roll Dart to b21dca1b89ff (flutter/flutter#172038)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 2ea2ba09ef85 to 92354f64e37f (1 revision) (flutter/flutter#172039)
2025-07-11 zhongliu88889@gmail.com Fix CheckedPopupMenuItem semantics to use menuItemCheckbox role with checked state (flutter/flutter#171749)
2025-07-11 30870216+gaaclarke@users.noreply.github.com adds gemini.md to `engine` and `licenses_cpp` (flutter/flutter#172022)
2025-07-11 737941+loic-sharma@users.noreply.github.com [Web] Implement disabling interactive selection (flutter/flutter#171935)
2025-07-11 737941+loic-sharma@users.noreply.github.com [tool] Make google3 have to override feature flags (flutter/flutter#171933)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License cpp 710 (flutter/flutter#171989)
2025-07-11 muhatashim@google.com add content description to tooltip-only nodes for android (flutter/flutter#171541)
2025-07-11 jhy03261997@gmail.com [Web a11y]Update table cell to use LabelRepresentation.sizedSpan  (flutter/flutter#172013)
2025-07-11 bkonyi@google.com [ Tool ] Enable `omit_obvious_*_types` and `specify_nonobvious_*_types` lints (flutter/flutter#172018)
2025-07-11 zhongliu88889@gmail.com Add SemanticsLabelBuilder for Accessible Label Concatenation (flutter/flutter#171683)
2025-07-11 15619084+vashworth@users.noreply.github.com Run tests on either macOS 14 or 15 (flutter/flutter#171076)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from db1a5550c848 to 2ea2ba09ef85 (1 revision) (flutter/flutter#172017)
2025-07-11 dkwingsmt@users.noreply.github.com [Cupertino] Make some widgets no longer use RSuperellipse (flutter/flutter#171830)
2025-07-11 jason-simmons@users.noreply.github.com Detach the resource context from the IO thread only if the shell's IO manager is no longer being used by any other spawned shells (flutter/flutter#171554)
2025-07-11 30870216+gaaclarke@users.noreply.github.com Started querying the app state for the gpu disabled sync switch (flutter/flutter#171785)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License_cpp 7/02 (flutter/flutter#171558)
2025-07-11 sokolovskyi.konstantin@gmail.com [web] Refactor clipboard. (flutter/flutter#171427)
2025-07-11 matanlurey@users.noreply.github.com Require 64-bit Windows (flutter/flutter#171925)
2025-07-11 mdebbar@google.com Run hot_reload_with_asset_web_test.dart on Mac/Windows (flutter/flutter#171280)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from da7e3eae7c2b to db1a5550c848 (2 revisions) (flutter/flutter#171999)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 26571c3b1771 to da7e3eae7c2b (2 revisions) (flutter/flutter#171997)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 34a40032ff0a to 26571c3b1771 (1 revision) (flutter/flutter#171995)
2025-07-11 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from lO64ePNEGrGzs-MFC... to 8aoEy1hp2a9HI1pt-... (flutter/flutter#171993)
2025-07-10 pranav072bex@ioepc.edu.np Remove redundant ThemeData(useMaterial3: true) from tests (flutter/flutter#171569)
2025-07-10 jessiewong401@gmail.com [Android 16] Updated linux_android_emu to a 36 AVD in framework CI (flutter/flutter#169121)
2025-07-10 87506348+jingshao-code@users.noreply.github.com [iOS] Add Live Text option to system context menu (flutter/flutter#170969)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from dc3da09ca905 to 34a40032ff0a (1 revision) (flutter/flutter#171982)
2025-07-10 pedromassango.developer@gmail.com feat: Expose FocusNode of FocusTraversalGroup (flutter/flutter#171979)
2025-07-10 alex.medinsh@gmail.com `CupertinoDatePicker` and `CupertinoTimerPicker` new onChanged behavior (flutter/flutter#170793)
2025-07-10 jason-simmons@users.noreply.github.com Manual roll Dart SDK from 8d69b07b9d9d to 07ea3aaaadf0 (32 revisions) (flutter/flutter#171969)
2025-07-10 34465683+rkishan516@users.noreply.github.com Style: Rename pageBuilder with builder in showCupertinoSheet (flutter/flutter#170625)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from bdb8bfcde7f3 to dc3da09ca905 (3 revisions) (flutter/flutter#171971)
2025-07-10 34465683+rkishan516@users.noreply.github.com Feat: Add foreground color for cupertino button (flutter/flutter#170898)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from 0fef076beec3 to bdb8bfcde7f3 (34 revisions) (flutter/flutter#171964)
2025-07-10 mdebbar@google.com Run stateless_stateful_hot_reload_web_test.dart on Mac/Windows (flutter/flutter#171283)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

...
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
This PR adds `RSuperellipse` support to Web, so that these ops will
actually draw `RSuperellipse`s instead of falling back to `RRect`s,
except for platform views.
* (I was told in some earlier comments that RSuperellipses should fall
back to RRects for platform views but I can't remember where for now. If
reviewers think otherwise I can implement them right away or make this a
TODO in the future.)

The `RSuperellipse`s are drawn after being converted to paths. The
algorithm is nothing new, but already used in
`round_superellipse_param.cc`.

For performance optimization, `RSuperellipse`s that have uniform radii
will have their paths cached in a global cache after offset
normalization.

This PR does not add any new public APIs. (Although, I'm planning to
also implement this to the main `dart:ui` in the future to support
non-Impeller-nor-Web platforms, which will need
`RSuperellipse.toPathOffset` public.)

Fixes flutter#163718

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9602)

Roll Flutter from 43657f3baa17 to 35f197f1e5f5 (39 revisions)

flutter/flutter@43657f3...35f197f

2025-07-12 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 8aoEy1hp2a9HI1pt-... to xQlbHCUI33kDvkew8... (flutter/flutter#172060)
2025-07-12 dkwingsmt@users.noreply.github.com Add RSuperellipse support to Web (global cache) (flutter/flutter#171489)
2025-07-12 87506348+jingshao-code@users.noreply.github.com Fix grammar: Change 'A' to 'An' before IOSSystemContextMenuItemData (flutter/flutter#172019)
2025-07-11 jason-simmons@users.noreply.github.com Manual roll Dart to b21dca1b89ff (flutter/flutter#172038)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 2ea2ba09ef85 to 92354f64e37f (1 revision) (flutter/flutter#172039)
2025-07-11 zhongliu88889@gmail.com Fix CheckedPopupMenuItem semantics to use menuItemCheckbox role with checked state (flutter/flutter#171749)
2025-07-11 30870216+gaaclarke@users.noreply.github.com adds gemini.md to `engine` and `licenses_cpp` (flutter/flutter#172022)
2025-07-11 737941+loic-sharma@users.noreply.github.com [Web] Implement disabling interactive selection (flutter/flutter#171935)
2025-07-11 737941+loic-sharma@users.noreply.github.com [tool] Make google3 have to override feature flags (flutter/flutter#171933)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License cpp 710 (flutter/flutter#171989)
2025-07-11 muhatashim@google.com add content description to tooltip-only nodes for android (flutter/flutter#171541)
2025-07-11 jhy03261997@gmail.com [Web a11y]Update table cell to use LabelRepresentation.sizedSpan  (flutter/flutter#172013)
2025-07-11 bkonyi@google.com [ Tool ] Enable `omit_obvious_*_types` and `specify_nonobvious_*_types` lints (flutter/flutter#172018)
2025-07-11 zhongliu88889@gmail.com Add SemanticsLabelBuilder for Accessible Label Concatenation (flutter/flutter#171683)
2025-07-11 15619084+vashworth@users.noreply.github.com Run tests on either macOS 14 or 15 (flutter/flutter#171076)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from db1a5550c848 to 2ea2ba09ef85 (1 revision) (flutter/flutter#172017)
2025-07-11 dkwingsmt@users.noreply.github.com [Cupertino] Make some widgets no longer use RSuperellipse (flutter/flutter#171830)
2025-07-11 jason-simmons@users.noreply.github.com Detach the resource context from the IO thread only if the shell's IO manager is no longer being used by any other spawned shells (flutter/flutter#171554)
2025-07-11 30870216+gaaclarke@users.noreply.github.com Started querying the app state for the gpu disabled sync switch (flutter/flutter#171785)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License_cpp 7/02 (flutter/flutter#171558)
2025-07-11 sokolovskyi.konstantin@gmail.com [web] Refactor clipboard. (flutter/flutter#171427)
2025-07-11 matanlurey@users.noreply.github.com Require 64-bit Windows (flutter/flutter#171925)
2025-07-11 mdebbar@google.com Run hot_reload_with_asset_web_test.dart on Mac/Windows (flutter/flutter#171280)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from da7e3eae7c2b to db1a5550c848 (2 revisions) (flutter/flutter#171999)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 26571c3b1771 to da7e3eae7c2b (2 revisions) (flutter/flutter#171997)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 34a40032ff0a to 26571c3b1771 (1 revision) (flutter/flutter#171995)
2025-07-11 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from lO64ePNEGrGzs-MFC... to 8aoEy1hp2a9HI1pt-... (flutter/flutter#171993)
2025-07-10 pranav072bex@ioepc.edu.np Remove redundant ThemeData(useMaterial3: true) from tests (flutter/flutter#171569)
2025-07-10 jessiewong401@gmail.com [Android 16] Updated linux_android_emu to a 36 AVD in framework CI (flutter/flutter#169121)
2025-07-10 87506348+jingshao-code@users.noreply.github.com [iOS] Add Live Text option to system context menu (flutter/flutter#170969)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from dc3da09ca905 to 34a40032ff0a (1 revision) (flutter/flutter#171982)
2025-07-10 pedromassango.developer@gmail.com feat: Expose FocusNode of FocusTraversalGroup (flutter/flutter#171979)
2025-07-10 alex.medinsh@gmail.com `CupertinoDatePicker` and `CupertinoTimerPicker` new onChanged behavior (flutter/flutter#170793)
2025-07-10 jason-simmons@users.noreply.github.com Manual roll Dart SDK from 8d69b07b9d9d to 07ea3aaaadf0 (32 revisions) (flutter/flutter#171969)
2025-07-10 34465683+rkishan516@users.noreply.github.com Style: Rename pageBuilder with builder in showCupertinoSheet (flutter/flutter#170625)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from bdb8bfcde7f3 to dc3da09ca905 (3 revisions) (flutter/flutter#171971)
2025-07-10 34465683+rkishan516@users.noreply.github.com Feat: Add foreground color for cupertino button (flutter/flutter#170898)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from 0fef076beec3 to bdb8bfcde7f3 (34 revisions) (flutter/flutter#171964)
2025-07-10 mdebbar@google.com Run stateless_stateful_hot_reload_web_test.dart on Mac/Windows (flutter/flutter#171283)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
This PR adds `RSuperellipse` support to Web, so that these ops will
actually draw `RSuperellipse`s instead of falling back to `RRect`s,
except for platform views.
* (I was told in some earlier comments that RSuperellipses should fall
back to RRects for platform views but I can't remember where for now. If
reviewers think otherwise I can implement them right away or make this a
TODO in the future.)

The `RSuperellipse`s are drawn after being converted to paths. The
algorithm is nothing new, but already used in
`round_superellipse_param.cc`.

For performance optimization, `RSuperellipse`s that have uniform radii
will have their paths cached in a global cache after offset
normalization.

This PR does not add any new public APIs. (Although, I'm planning to
also implement this to the main `dart:ui` in the future to support
non-Impeller-nor-Web platforms, which will need
`RSuperellipse.toPathOffset` public.)

Fixes flutter#163718

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. platform-web Web applications specifically will affect goldens Changes to golden files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Web] Implement RSuperellipse on Web
2 participants