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

[web] Support raw straight RGBA format in Image.toByteData() in Html #28357

Merged

Conversation

ColdPaleLight
Copy link
Member

@ColdPaleLight ColdPaleLight commented Aug 29, 2021

Fix issue : flutter/flutter#89094

Detail: #28339 (comment)

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.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Aug 29, 2021
@google-cla google-cla bot added the cla: yes label Aug 29, 2021
@ColdPaleLight ColdPaleLight requested a review from dnfield August 29, 2021 12:33
@ColdPaleLight ColdPaleLight force-pushed the image_straight_rgba_html branch from 80dae99 to 84ef623 Compare August 29, 2021 13:40
@@ -172,18 +172,15 @@ class HtmlImage implements ui.Image {

@override
Future<ByteData?> toByteData({ui.ImageByteFormat format = ui.ImageByteFormat.rawRgba}) {
if (format == ui.ImageByteFormat.rawRgba) {
// TODO(ColdPaleLight): https://github.com/flutter/flutter/issues/89128
if (format == ui.ImageByteFormat.rawRgba || format == ui.ImageByteFormat.rawStraightRgba) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Please write this as a switch statement, and update the comment to make it clear that we're always returning straight rather than premul. I thought we also had an issue to look at using webGL to do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM with nit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes customer: alibaba platform-web Code specifically for the web engine waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants