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

Conversation

@harryterkelsen
Copy link
Contributor

Uses a WebGL surface in conjunction with readPixels to make an image from an SkPicture. This is needed since the picture may contain GL texture-backed images.

Fixes flutter/flutter#103803

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • 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 Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • 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 harryterkelsen requested a review from yjbanov August 9, 2022 18:30
@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Aug 9, 2022
final ByteData? data = await image.toByteData();
expect(data, isNotNull);
expect(data!.lengthInBytes, 10 * 15 * 4);
expect(data.buffer.asUint32List().any((int byte) => byte != 0), isTrue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Bonus points if this is also a golden test

@skia-gold
Copy link

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

@skia-gold
Copy link

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

@skia-gold
Copy link

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

@skia-gold
Copy link

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

@skia-gold
Copy link

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

@skia-gold
Copy link

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

@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 #35276 at sha dacaf3b

@skia-gold
Copy link

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

@flutter-dashboard
Copy link

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

Changes reported for pull request #35276 at sha 102e06b

@skia-gold
Copy link

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

@jonahwilliams
Copy link
Contributor

I'm not sure the entire context for this fix, but note that this is a large performance regression in cases where it is not needed. In general, reading back from the GPU is a high latency operation and should be avoided at all costs

width: width,
height: height,
);
final Uint8List pixels = skImage.readPixels(0, 0, imageInfo);
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifically this part

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-web Code specifically for the web engine will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web] Cropped Picture to Image fails to load

4 participants