fix(common): decode the crop view image at screen resolution - #720
Merged
Conversation
`CropView` computed its decode size from `Screen.mainScreen.widthDIPs`, but that number reaches decoders that expect pixels: `decodeWidth` ends up in Fresco's `ResizeOptions`, and `loadImage`'s `resizeThreshold` in the native processor. On a 1080x2340 screen the image was therefore decoded at 780px and upscaled to fill the view, so a freshly captured photo looked far blurrier than the camera preview it replaces. Reuse `IMAGE_DECODE_HEIGHT`, which is built from `widthPixels`/`heightPixels` and is already what the rest of the app passes as a decode size. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
CropViewderived its decode size fromScreen.mainScreen.widthDIPs/heightDIPs, but that value reaches decoders that expect pixels:decodeWidthends up in Fresco'sResizeOptions, and the magnifier'sloadImage({ resizeThreshold })goes to the native processor. On a 1080x2340 screen the image was decoded at 780px and then upscaled to fill the view, so the photo shown right after a capture looked markedly blurrier than the camera preview it replaces — even though the captured file itself is sharp.IMAGE_DECODE_HEIGHT(widthPixels/heightPixels), which is already what the rest of the app passes as a decode size. On a 1080x2340 device that is 780 -> 2340.Note this decodes ~9x more pixels for that one bitmap, which is what every other image view in the app already does.
Testing
npx eslintclean,svelte-checkreports 0 errorsA visual confirmation on device that the review screen now matches the preview's sharpness is still worth doing.