Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@harryterkelsen
Copy link
Contributor

This allows us to fix some bugs in the CanvasKit backend.

  • Implement RRect where the radii are different
  • Implement drawDRRect
  • Implement ColorFilter
  • Implement the correct arcTo for arcToPoint

Screenshots

Using drawDRRect for checkboxes

drrect

Showing ColorFilter in the "Animation" demo

colorfilter

Using correct arcTo to get the correct notch under the FAB

correctnotch

This allows us to fix some bugs in the CanvasKit backend.

- Implement RRect where the radii are different
- Implement drawDRRect
- Implement ColorFilter
- Implement the correct `arcTo` for `arcToPoint`
final js.JsArray colorMatrix = js.JsArray();
colorMatrix.length = 20;
for (int i = 0; i < 20; i++) {
colorMatrix[i] = filter._matrix[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave a todo to remove this double-conversion. This should, at least, convert straight to a Float64List, but ideally we should write to WASM memory directly.

/cc @kjlubick - here's an example for excessive conversion that we talked about at the last sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// EXPERIMENTAL: Enable the Skia-based rendering backend.
const bool experimentalUseSkia =
bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: false);
bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: true);
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to keep this as false.

BTW, have you checked the code size difference with and without this backend? If the size difference is small (say <50KB gzipped), I'd say let's make it a dynamic option. I imagine most of the size cost is from the WASM blob, not from Dart code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll investigate after landing this PR

- Add TODO to avoid unnecessary conversions
- Don't set CanvasKit to default
- Fix licenses file
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants