-
Notifications
You must be signed in to change notification settings - Fork 6k
Add an API in ui_web to create a ui.Image from an ImageBitmap
#45256
Add an API in ui_web to create a ui.Image from an ImageBitmap
#45256
Conversation
|
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. |
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This should help make flutter_svg much better on web.
|
svg_image_bitmap_fragment_shader_sampler looks like it has artifacts to me, but I'm not sure if that's just how that test is supposed to work. |
That's actually the expected output of the shader. It's the "glitch" shader lifted from the |
|
|
||
| @JS('MakeLazyImageFromTextureSource') | ||
| external SkImage? _MakeLazyImageFromTextureSource( | ||
| external SkImage? _MakeLazyImageFromTextureSource1( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there's value in reusing the Dart SDK convention, but there the convention is for the number to refer to the argument count, so in this case it would be "2" and "3", instead of "1" and "2".
| ); | ||
| } | ||
|
|
||
| /// Creates a [ui.Image] from an ImageBitmap object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: dartdoc likes it when there's one empty line between the first and the second paragraph (or between paragraphs in general).
| /// See https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap | ||
| FutureOr<ui.Image> createImageFromImageBitmap(JSAny imageSource) { | ||
| if (!domInstanceOfString(imageSource, 'ImageBitmap')) { | ||
| throw Exception('Image source $imageSource is not an ImageBitmap!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be a ArgumentError.
nit: s/!/./
|
Golden file changes are available for triage from new commit, Click here to view. |
…133706) flutter/engine@b63eee2...d37cef8 2023-08-30 [email protected] [web] Roll to most recent fallback font data (flutter/engine#45301) 2023-08-30 [email protected] Increase maximum length of function names from 30 to 60. (flutter/engine#45296) 2023-08-30 [email protected] Add an API in `ui_web` to create a `ui.Image` from an `ImageBitmap` (flutter/engine#45256) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This API will help with situations in which the user has a browser resource that they want to transform into a
ui.Imageand render directly into the layer tree. Most browser resources can be converted to anImageBitmapvia thecreateImageBitmapAPI.