Repository navigation
Conversation
When a Coil-loaded source has no width/height, the loader requests maxSize x maxSize with Scale.FIT. With no target view Coil resolves that to exact precision and scales smaller images up to fill it, so a 1600px photo came back at 2048px with the default maxSize. Request inexact precision in that case so maxSize is only an upper bound, matching iOS, fitWithinMax and the documented behavior. Fixes JimmyDaddy#444 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #444.
On Android, a Coil-loaded source with no
width/height(file://,content://,http(s)://) was scaled up to fillmaxSizexmaxSize. With the defaultmaxSizeof 2048, a 1600x1200 photo came out at 2048x1536. iOS,ImageMarkerCore.fitWithinMaxand themaxSizedocs all treat it as an upper bound only.With no source size, the loader requests
.size(maxSize, maxSize).scale(Scale.FIT). The request has no target view, so Coil 2 resolves it toPrecision.EXACT, andBitmapFactoryDecoderonly skips upscaling when an inexact size is allowed. This PR setsPrecision.INEXACTfor that case only:Size.ORIGINALhere.maxSize. With an inexact size, Coil still scales down and only skips scaling up.width/heightkeep their existing exact sizing, so resource/asset sizing doesn't change.Validation
MarkerImageLoaderTest.doesNotUpscaleCoilSourceWithoutExplicitSize. It loads the 3x2 test content-provider image with the defaultmaxSize.AssertionError: expected:<3> but was:<2048>MarkerImageLoaderTest+ImageMarkerRendererTest(32 tests) andImageMarkerJsE2ETest(4 tests, with Metro) all pass on a Pixel 9 API 35 emulator.repeatedlyDownsamplesLargeInputsWithinTheMemoryBoundandbase64DecodeFitsSourceWithinMaxSizeWithoutCropping, which cover the scale-down path.npm run typechecknpm run lintnpx jest(158 tests)