engine icon indicating copy to clipboard operation
engine copied to clipboard

[canvaskit] Decode images using <img> tag decoding

Open harryterkelsen opened this issue 1 year ago • 1 comments

Prefer to decode images using the browser API rather than with CanvasKit to avoid jank when decoding.

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • [ ] I listed at least one issue that this PR fixes in the description above.
  • [ ] I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I signed the CLA.
  • [ ] All existing and new tests are passing.

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

harryterkelsen avatar Jun 04 '24 19:06 harryterkelsen

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

flutter-dashboard[bot] avatar Jun 24 '24 20:06 flutter-dashboard[bot]

This change causes the CanvasKit renderer to default to decoding using ImageDecoder when it's available, or using an ImageElement otherwise. To facilitate this, some helper methods were added which can read the pixels and resize ImageElement images using a DOM canvas, as a workaround to a bug in CanvasKit where getting pixel data from images created from textures returns an array of all 0s.

harryterkelsen avatar Jul 11 '24 20:07 harryterkelsen

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.

Changes reported for pull request #53201 at sha e7aff4633b39ad7943a5a2d4a845adb0359b8968

flutter-dashboard[bot] avatar Jul 18 '24 22:07 flutter-dashboard[bot]