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

Conversation

@eyebrowsoffire
Copy link
Contributor

This fixes 110599

Previously, the BitmapCanvas would always insert DOM elements for images. However, this doesn't work if the user is using the canvas to composite data (i.e. _preserveImageData is set). Make it so that we draw images directly into the canvas if this is set.

Also, if a data URL is requested from the canvas pool and we have no canvas, we have to create a canvas and create the data URL anyway, otherwise we end up with exceptions if the user hasn't actually drawn anything to the canvas.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Sep 9, 2022
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

// element onto the canvas.
// TODO(jacksongardner): Make this actually work with color filters.
setUpPaint(paint, null);
_canvasPool.drawImage(imgElement as DomHTMLImageElement, p);
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we guarantee that this cast will succeed?

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 don't know why all these methods just pass around DomHTMLElement when they all are DomHTMLImageElement. I guess I could clean that up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh, there is actually one case where it's a div.

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 3.
View them at https://flutter-engine-gold.skia.org/cl/github/36058

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 4.
View them at https://flutter-engine-gold.skia.org/cl/github/36058

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 5.
View them at https://flutter-engine-gold.skia.org/cl/github/36058

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 6.
View them at https://flutter-engine-gold.skia.org/cl/github/36058

@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 #36058 at sha edabb60

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 12, 2022
@auto-submit auto-submit bot merged commit 372b3bd into flutter:main Sep 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 12, 2022
cfontas pushed a commit to cfontas/engine that referenced this pull request Sep 14, 2022
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 2022
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 platform-web Code specifically for the web engine will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picture.toImage fails for --web-renderer html

3 participants