Skip to content

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Dec 26, 2024

This PR adds support for clipping round superellipse to the engine.

For what a rounded superellipse is, see this design doc. Video demos can be found at flutter/engine#56726 and #161409.

Only impeller can actually render it. On Skia and Web, this shape falls back to RRect.

Part of #139321 and #13914, also related to #91523.

Pre-launch Checklist

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

@github-actions github-actions bot added the engine flutter/engine related. See also e: labels. label Dec 26, 2024
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Jan 3, 2025
@github-actions github-actions bot removed framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Jan 3, 2025
void DisplayListBuilder::DrawRoundSuperellipse(const DlRoundSuperellipse& rse,
const DlPaint& paint) {
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawRSuperellipseFlags);
drawRoundSuperellipse(rse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Because the draw call might optimize to rect and circle, and because we may have synchronized a (style==Stroke) attribute, you can make sure that the right attributes are in the stream by using something like

  saved_style = GetDrawStyle();
  // Only needed while we temporarily ignore stroking for RoundSuperellipses
  // We change the attribute even though it is ignored so that optimizing to
  // drawRect and drawCircle don't stroke it (yet).
  setDrawStyle(kFill);
  drawRSE(...);
  setDrawStyle(saved_style);

Note that I used the lower case set() call because that does the testing for whether or not it needs to synch that attribute.

Since it is only 3 lines of code, this technique could be used inside drawRSE only when we optimize, I'm not sure the case happens often enough to optimize especially since we plan to implement stroking soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another thought. If we have rse => roundRect conversion capability, then perhaps we can check for stroking and redirect to drawRoundRect in the short term?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I've added support for stroking RSEs, is this comment no longer relevant?

static constexpr DisplayListAttributeFlags kDrawRSuperellipseFlags{
kBasePaintFlags | //
kIsFilledGeometry //
// TODO(dkwingsmt): Support strokes.
Copy link
Contributor

Choose a reason for hiding this comment

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

also kUsesMaskFilter and kUsesAntialias. Everything in kBaseStrokeFlags except for IsDrawn... (We do need mask filters on these for shadows, don't we? And AA is ignored by Impeller, but it matters for Skia so we need to make sure we list that flag so we synch that attribute.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I've added support for stroking RSEs, I've changed the flags to be the same as RRects. Can you take a look if it's correct?

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

I left some comments on the DL side of things and skimmed over the Impeller side.

One thing that I think is required here are unit tests that cover these new calls, including:

  • adding clipRSE variants to the array of invokers in dl_test_snippets.cc - use the "Clip/DrawRRect" sections as inspiration.
  • adding clipRSE variants to the test parameters in dl_rendering_unittests.cc - look for the code that tests a couple of variants of clipRRect for inspiration. clipRRect is considered an attribute to test against so it will need code in the RenderWithClips method. drawRRect is considered a rendering call so it will need a new TEST(...) instance - again look for the TEST(..., DrawRoundRect) test for inspiration
  • a full suite of ClipRSELayer tests per any of the other foo_layer_unittests.cc in that same directory
  • adding test cases to layer_stack and/or matrixcliptracker unit test files
  • tests in impeller/entity/geometry and impeller/geometry to match other geometry classes

@github-actions github-actions bot added the e: impeller Impeller rendering backend issues and features requests label Feb 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 27, 2025
Manual roll requested by [email protected]

flutter/flutter@043b719...1659206

2025-02-24 [email protected] Roll Skia from 3dfb3fee52e1 to 28017200173a (2 revisions) (flutter/flutter#163981)
2025-02-24 [email protected] Add integration test for Gradle-initiated android builds with flavors (flutter/flutter#163737)
2025-02-23 [email protected] Roll Skia from 72f949950adb to 3dfb3fee52e1 (1 revision) (flutter/flutter#163959)
2025-02-23 [email protected] Roll Skia from 4bee660601de to 72f949950adb (1 revision) (flutter/flutter#163948)
2025-02-22 [email protected] Roll Skia from cca9328df6ca to 4bee660601de (1 revision) (flutter/flutter#163927)
2025-02-22 [email protected] Roll Dart SDK from bad289580d9b to aea6fff33f06 (3 revisions) (flutter/flutter#163912)
2025-02-22 [email protected] Roll Skia from 1d884bab8593 to cca9328df6ca (12 revisions) (flutter/flutter#163910)
2025-02-22 [email protected] [fuchsia] include more tests in the fuchsia builders (flutter/flutter#163800)
2025-02-21 [email protected] [Engine] Add RoundSuperellipse to drawing OP (flutter/flutter#160883)
2025-02-21 [email protected] [remake] Restore old back handling for FlutterFragmentActivity (flutter/flutter#161545)
2025-02-21 [email protected] Revert "Marks Mac_benchmark basic_material_app_macos__compile to be flaky" (flutter/flutter#163878)
2025-02-21 [email protected] Revert "Marks Mac_benchmark flutter_view_macos__start_up to be flaky" (flutter/flutter#163880)
2025-02-21 [email protected] Roll Dart SDK from c5e582f15b6c to bad289580d9b (1 revision) (flutter/flutter#163885)
2025-02-21 [email protected] Revert "Marks Windows_mokey native_assets_android to be flaky" (flutter/flutter#163881)
2025-02-21 [email protected] Mark platform_views_hcpp_scroll_perf__timeline_summary out of bringup (flutter/flutter#163883)
2025-02-21 [email protected] Roll Skia from 6da10829d017 to 1d884bab8593 (42 revisions) (flutter/flutter#163789)
2025-02-21 [email protected] Enable `linux_android_emulator_tests` on presubmit. (flutter/flutter#163879)
2025-02-21 [email protected] Update gradle memory properties in example and test projects (flutter/flutter#163798)
2025-02-21 [email protected] Secure paste milestone 2 (flutter/flutter#159013)

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 [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
)

Manual roll requested by [email protected]

flutter/flutter@043b719...1659206

2025-02-24 [email protected] Roll Skia from 3dfb3fee52e1 to 28017200173a (2 revisions) (flutter/flutter#163981)
2025-02-24 [email protected] Add integration test for Gradle-initiated android builds with flavors (flutter/flutter#163737)
2025-02-23 [email protected] Roll Skia from 72f949950adb to 3dfb3fee52e1 (1 revision) (flutter/flutter#163959)
2025-02-23 [email protected] Roll Skia from 4bee660601de to 72f949950adb (1 revision) (flutter/flutter#163948)
2025-02-22 [email protected] Roll Skia from cca9328df6ca to 4bee660601de (1 revision) (flutter/flutter#163927)
2025-02-22 [email protected] Roll Dart SDK from bad289580d9b to aea6fff33f06 (3 revisions) (flutter/flutter#163912)
2025-02-22 [email protected] Roll Skia from 1d884bab8593 to cca9328df6ca (12 revisions) (flutter/flutter#163910)
2025-02-22 [email protected] [fuchsia] include more tests in the fuchsia builders (flutter/flutter#163800)
2025-02-21 [email protected] [Engine] Add RoundSuperellipse to drawing OP (flutter/flutter#160883)
2025-02-21 [email protected] [remake] Restore old back handling for FlutterFragmentActivity (flutter/flutter#161545)
2025-02-21 [email protected] Revert "Marks Mac_benchmark basic_material_app_macos__compile to be flaky" (flutter/flutter#163878)
2025-02-21 [email protected] Revert "Marks Mac_benchmark flutter_view_macos__start_up to be flaky" (flutter/flutter#163880)
2025-02-21 [email protected] Roll Dart SDK from c5e582f15b6c to bad289580d9b (1 revision) (flutter/flutter#163885)
2025-02-21 [email protected] Revert "Marks Windows_mokey native_assets_android to be flaky" (flutter/flutter#163881)
2025-02-21 [email protected] Mark platform_views_hcpp_scroll_perf__timeline_summary out of bringup (flutter/flutter#163883)
2025-02-21 [email protected] Roll Skia from 6da10829d017 to 1d884bab8593 (42 revisions) (flutter/flutter#163789)
2025-02-21 [email protected] Enable `linux_android_emulator_tests` on presubmit. (flutter/flutter#163879)
2025-02-21 [email protected] Update gradle memory properties in example and test projects (flutter/flutter#163798)
2025-02-21 [email protected] Secure paste milestone 2 (flutter/flutter#159013)

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 [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
)

Manual roll requested by [email protected]

flutter/flutter@043b719...1659206

2025-02-24 [email protected] Roll Skia from 3dfb3fee52e1 to 28017200173a (2 revisions) (flutter/flutter#163981)
2025-02-24 [email protected] Add integration test for Gradle-initiated android builds with flavors (flutter/flutter#163737)
2025-02-23 [email protected] Roll Skia from 72f949950adb to 3dfb3fee52e1 (1 revision) (flutter/flutter#163959)
2025-02-23 [email protected] Roll Skia from 4bee660601de to 72f949950adb (1 revision) (flutter/flutter#163948)
2025-02-22 [email protected] Roll Skia from cca9328df6ca to 4bee660601de (1 revision) (flutter/flutter#163927)
2025-02-22 [email protected] Roll Dart SDK from bad289580d9b to aea6fff33f06 (3 revisions) (flutter/flutter#163912)
2025-02-22 [email protected] Roll Skia from 1d884bab8593 to cca9328df6ca (12 revisions) (flutter/flutter#163910)
2025-02-22 [email protected] [fuchsia] include more tests in the fuchsia builders (flutter/flutter#163800)
2025-02-21 [email protected] [Engine] Add RoundSuperellipse to drawing OP (flutter/flutter#160883)
2025-02-21 [email protected] [remake] Restore old back handling for FlutterFragmentActivity (flutter/flutter#161545)
2025-02-21 [email protected] Revert "Marks Mac_benchmark basic_material_app_macos__compile to be flaky" (flutter/flutter#163878)
2025-02-21 [email protected] Revert "Marks Mac_benchmark flutter_view_macos__start_up to be flaky" (flutter/flutter#163880)
2025-02-21 [email protected] Roll Dart SDK from c5e582f15b6c to bad289580d9b (1 revision) (flutter/flutter#163885)
2025-02-21 [email protected] Revert "Marks Windows_mokey native_assets_android to be flaky" (flutter/flutter#163881)
2025-02-21 [email protected] Mark platform_views_hcpp_scroll_perf__timeline_summary out of bringup (flutter/flutter#163883)
2025-02-21 [email protected] Roll Skia from 6da10829d017 to 1d884bab8593 (42 revisions) (flutter/flutter#163789)
2025-02-21 [email protected] Enable `linux_android_emulator_tests` on presubmit. (flutter/flutter#163879)
2025-02-21 [email protected] Update gradle memory properties in example and test projects (flutter/flutter#163798)
2025-02-21 [email protected] Secure paste milestone 2 (flutter/flutter#159013)

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 [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants