Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make upscaling images opt-in #59856

Merged
merged 6 commits into from
Jun 23, 2020
Merged

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Jun 19, 2020

Description

We should be discouraging users from upscaling images, which causes increased memory usage. This problem arises because users typically do not know the intrinsic dimensions of the compressed image data, and may be providing cache width/height values that exceed the dimensions of the image.

Once this lands, we can default the parameter to false in the engine as well.

/cc @zanderso @chinmaygarde FYI

Related Issues

Part of #59578
Engine side PR was flutter/engine#19067

Tests

Test that upscaling still works when the parameter is set to true
Test that downscaling works (previously untested)
Test that upscaling is not applied when the parameter is set to false.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

I'll do a FROB run to make sure this breaks nothing internally.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Jun 19, 2020
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -84,13 +84,15 @@ mixin PaintingBinding on BindingBase, ServicesBinding {
Future<ui.Codec> instantiateImageCodec(Uint8List bytes, {
int cacheWidth,
int cacheHeight,
bool allowUpscaling = false,
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a sentence about this parameter to the doc comment above?

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 updated the docstring in general here - there were some old no-longer-existant things in there and some formatting issues, as well as something that's changed about aspect ratio preservation. PTAL

@goderbauer
Copy link
Member

Cirrus failure are presumably resolved when the engine roll lands?

@dnfield
Copy link
Contributor Author

dnfield commented Jun 19, 2020

Analysis issues are places in the code where I failed to fix up signatures. Will take a look and add the doc comment.

@dnfield
Copy link
Contributor Author

dnfield commented Jun 20, 2020

My FROB run had lots of failures, but none of them seem related to this change. That's the best I can make of that :\

@dnfield dnfield added the a: images Loading, displaying, rendering images label Jun 22, 2020
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

Still LGTM

Thanks for the updated docs!

@dnfield dnfield merged commit e8fa87e into flutter:master Jun 23, 2020
@dnfield dnfield deleted the resize_upscale_opt branch June 23, 2020 16:20
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
* Make upscaling images opt-in
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: images Loading, displaying, rendering images framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants