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

[VMD] Fix image sampling on android #151

Merged
merged 2 commits into from
Mar 28, 2023
Merged

Conversation

npresseault
Copy link
Member

@npresseault npresseault commented Mar 27, 2023

Description

Since we are using coil rememberAsyncImagePainter instead of AsyncImage, we are losing a few built-in features such as sampling in the image request decoding.

This passes size and scale parameters in the image request which will later be used to calculate the sample size. The size is a ConstraintsSizeResolver which will passed as a modifier for contraints to be resolved. This is a similar strategy employed in coil with AsyncImage.

NOTE: The Image is now nested within a Box and takes a block with a BoxScope as a receiver. If you are using that, you might want to switch your placeholder modifiers to match parent Box.

Motivation and Context

When large source images are provided, the image decoding could be slower and take more memory. This was due to the whole image being loaded even though the target size was be significantly smaller.

How Has This Been Tested?

Tested both in sample app and in another app.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@npresseault npresseault merged commit c28c39a into master Mar 28, 2023
@npresseault npresseault deleted the bugfix/image-sampling branch March 28, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants