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

Add createImageFromTextureSource method to ui_web #53483

Merged
merged 11 commits into from
Jun 21, 2024

Conversation

jezell
Copy link

@jezell jezell commented Jun 20, 2024

Adds createImageFromTextureSource for flutter web, exposed in dart:web_ui.

final ui.Image uiImage = renderer.createImageFromTextureSource(bitmap,
            width: 150, height: 150, transferOwnership: false);

In canvaskit renderer, this will use MakeLazyImageFromTextureSource. In SkWasmRenderer, it will call imageCreateFromTextureSource, which was already implemented in SkWasm for createImageFromImageBitmap to use, but was not exposed in a way that it could be taken advantage of.

By default, createImageFromTextureSource will create a copy of the object it is passed, but transferOwnership: true may be specified to allow transferable objects to be transferred to the renderer, avoiding the copy.

Fixes: flutter/flutter#150479
Fixes: flutter/flutter#144815

Copy link

google-cla bot commented Jun 20, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jezell jezell force-pushed the create_image_from_texture_source branch from fd6d3b9 to c305f03 Compare June 20, 2024 06:37
@renancaraujo

This comment was marked as off-topic.

@kevmoo
Copy link
Contributor

kevmoo commented Jun 20, 2024

@jezell – look at a rebase and failing tests?

@kevmoo
Copy link
Contributor

kevmoo commented Jun 20, 2024

@jezell Are the impeller changes related?

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.

This looks like it has pulled in a bunch of unrelated changes. Can you clean this PR up so that only contains the changes related to the proposed createImageFromTextureSource API?

@jezell jezell force-pushed the create_image_from_texture_source branch from c305f03 to ff4b00f Compare June 20, 2024 19:18
@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.

Changes reported for pull request #53483 at sha 7d71661

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.

Looks good to me, modulo a few random formatting things, and one requested change to the API surface. Thanks for the fix! I think this will be a good addition.

jezell and others added 2 commits June 20, 2024 17:01
Co-authored-by: Jackson Gardner <[email protected]>
Co-authored-by: Jackson Gardner <[email protected]>
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #53483 at sha c1ad286

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #53483 at sha 68fe742

@eyebrowsoffire
Copy link
Contributor

I approved the new goldens.

@kevmoo
Copy link
Contributor

kevmoo commented Jun 21, 2024

Okay to auto-submit @eyebrowsoffire ?

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2024
Copy link
Contributor

auto-submit bot commented Jun 21, 2024

auto label is removed for flutter/engine/53483, due to This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2024
@auto-submit auto-submit bot merged commit c458d12 into flutter:main Jun 21, 2024
32 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
@jezell
Copy link
Author

jezell commented Jun 21, 2024

Thanks @kevmoo @eyebrowsoffire

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller platform-android platform-ios platform-web Code specifically for the web engine will affect goldens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose MakeLazyImageFromTextureSource in dart:ui_web createImageFromImageBitmap should accept valid image sources other than ImageBitmap
5 participants