Repository navigation
feat(mygo): expose cached decoded image dimensions - #279
Merged
Merged
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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
Expose
Backend.NaturalImageSize(id) (width, height float32, ready bool)so desktop adapters can answer natural-size queries for standardimage,file-imageandavatarnodes without a second decoder or guessed layout dimensions.The read-only UI-thread query uses current registered images or the current retained state's decoded pixels. URL sources take precedence over registrations; source/decode-limit mismatches, pending work, retired nodes and closed resources return unavailable. Dimensions reflect actual decoded pixels, including
max-pixel-sizedownsampling, not cropping or placeholder sizes. Documents lifecycle and retry semantics indocs/api-migrations.md.Validated against the pinned MyGo dependency without workspace overrides:
gofmt,git diff --check,go test ./...,go test -race ./...,go vet ./...,go build ./...inplatform/mygo. No test changes: existing resource lifecycle, source replacement and decode-size contracts cover the underlying state; test-value-gate denied redundant getter tests. No UI-driven testing.Link to Devin session: https://app.devin.ai/sessions/79843e4449f241f7bef6c8b6b71c5354
Open in Devin Desktop: https://app.devin.ai/desktop/session/79843e4449f241f7bef6c8b6b71c5354?variant=devin
Requested by: @tiensonqin