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

Add support for overriding downsample mode per image request #2787

Closed
wants to merge 1 commit into from

Conversation

Abbondanzo
Copy link
Contributor

@Abbondanzo Abbondanzo commented Sep 9, 2024

Summary

Fresco currently supports global configuration of downsampling modes via the downsampleMode setting in ImagePipelineConfig. However, it is not currently possible to support per-image downsample settings. Out of the box, the vast majority of images should be downsampled to avoid drawing images which are too large to be displayed on a canvas. Android will throw a runtime exception in such cases. Yet, there are some usages which warrant outright disabling of downsampling as detailed in great lengths in issues like this one and this one.

This change introduces a new mechanism for overriding the globally-configured downsampleMode per image request by using a new downsampleOverride setting. If the override value gets set to a non-null DownsampleMode, the DecodeProducer will use that override instead. If no override is set, the downsample mode configured from the pipeline is chosen.

Examples

Here, you can see the subtle differences between two of the downsampling modes. These are applied via the new downsampleOverride setting. I have a follow-up PR that adds this to the showcase application.

NEVER ALWAYS
image image

Differential Revision: D62393210

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62393210

Reviewed By: yungsters

Differential Revision: D62393210
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62393210

@Abbondanzo
Copy link
Contributor Author

Closed by 9c57738

@Abbondanzo Abbondanzo closed this Sep 17, 2024
@Abbondanzo Abbondanzo deleted the export-D62393210 branch September 17, 2024 23:12
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Oct 7, 2024
Summary:
## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see facebook/fresco#2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.

## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0

Differential Revision: D63983051
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Oct 7, 2024
Summary:

## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see facebook/fresco#2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.

## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0

Differential Revision: D63983051
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Oct 7, 2024
Summary:
Pull Request resolved: #46864

## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see facebook/fresco#2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.

## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0

Reviewed By: oprisnik

Differential Revision: D63983051

fbshipit-source-id: 9ad0c40dfc864d24ffa39ca9e2bc0ddf8210f4f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants