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

Conversation

@bdero
Copy link
Member

@bdero bdero commented Jun 2, 2022

Fixes flutter/flutter#104217.

The framework can request images be decoded into smaller sizes. A subset of image generators support subpixel decoding at some sizes, and a subset of those support arbitrary pixel decoding. This change makes the Impeller decoder decode into a buffer at the closest supported size by the generator, and then resizes the pixel data into a new buffer. (Which is what we do for Skia).

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

/// 2. If the decoded image isn't the right target size, resize it.
///

const auto scaled_image_info = image_info.makeDimensions(target_size);
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps another TRACE_EVENT("impeller", "DecodeScale"); here?

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.

@bdero
Copy link
Member Author

bdero commented Jun 2, 2022

Expanded an existing Skia decoder test to run the Impeller decoder in the same way (fails prior to the fix).

@bdero bdero merged commit a5967ed into flutter:main Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 2, 2022
houhuayong pushed a commit to houhuayong/engine that referenced this pull request Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Support decoding images at any requested size in ImageDecoderImpeller

2 participants