Skip to content

Art tiles keep their picture's aspect: cover-crop by UV instead of stretching - #234

Merged
GLinnik21 merged 2 commits into
mainfrom
fix/art-aspect-cover-crop
Sep 25, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
fix/art-aspect-cover-crop

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Root cause

Every image the app fetches is a /photo/:/transcode?...&minSize=1. That parameter makes the server cover the requested box, not fit it, so a texture keeps the aspect of its source (rust-modules/src/img.rs, decode-budget note). The art-tile draw ignored this. On main, ui/widgets.rs:631-633 (Art::Person) resolved only the texture id (resolve_tex_on) and called p.tex_carded(t, r, ...). The card composite (gfx::draw_tex_impl → vs_img.vert) then drew UV 0..1 across the tile rect. So a 2:3 headshot requested at 300×300 decodes at 300×450, and it was squashed to two-thirds of its height in the 190 px cast circle. The other three Art arms, the profile-chip avatar and the player info panel's still all had the same problem.

Fix: one shared, aspect-preserving mapping

  • ui::Rect::cover_uv(tw, th, Crop) -> [f32; 4] is a pure function. It returns the UV window of a tw×th source that covers the rect with its aspect preserved:
    • A wider source loses its sides, evenly.
    • A taller source loses its top and bottom, split by Crop. Centre splits evenly. Headshot takes one fifth of the overflow off the top, so the face stays in frame.
    • An undecoded texture (0×0) gets UV_FULL, the whole texture.
  • gfx: draw_tex_impl takes a crop, and uv_compose folds it under the card composite's existing shadow-padding remap, so the shader and the draw count stay the same. draw_tex_carded/draw_tex_stroked take the crop; draw_tex_uv is new. Painter::tex_carded/tex_stroked take uv, Painter::tex_uv is new, and the backdrop-discovery record now includes the UV.
  • widgets::card is the single draw that every art tile goes through. It now resolves the texture together with its decoded size and draws with art_uv(&art, tw, th, r): Art::Person → Headshot, every other variant → Centre.
  • The id-only resolve_tex/resolve_tex_on are removed. The only way left to resolve a picture also returns the size needed to draw it without distortion.

Why cover and not fit (contain): the owner asked for "aspect fit", meaning never distort. For a circle or a rounded card, a contained picture leaves empty bands that look like a broken image. Cover-crop is the mapping that never distorts and still fills the shape. No consumer in this code is a case where true fit is clearly better. The one fit-shaped surface, the hero clearLogo, already uses contain math (hero_logo::fit) and sizes its rect to the logo's own aspect, so it is not affected.

Consumers

Migrated (all go through widgets::card → art_uv):

  • Cast & Crew row (screens/detail/cast.rs, Art::Person, Headshot)
  • Person page portrait (screens/person.rs, Art::Person, Headshot)
  • Search person results (screens/search/render.rs, Art::Person, Headshot)
  • Profile picker avatars (screens/profiles.rs, Art::Thumb, Centre)
  • Posters everywhere (Home shelves, Library grid and shelves, Related, person shelves, Search: Art::Poster). A poster is already at its tile's aspect, so this is the identity and the drawing is unchanged.
  • Landscape stills and Continue Watching stills (Art::Still). A 16:9 still in a 16:9 tile is unchanged. The poster fallback in still_key is now cropped instead of squashed.
  • Extras, chapters and filmography preview (Art::Thumb)

Migrated directly:

  • Profile chip avatar (widgets.rs, tex_stroked, Centre, the same framing as the picker)
  • Player info panel still (ui/info_panel.rs, tex_uv)

Checked and not affected:

  • Detail and Home backdrops, and hero_ground: these already use Rect::cover, which overflows a full-bleed quad at radius 0.
  • Hero clearLogo: uses contain math and a rect at the logo's own aspect.
  • Login QR: generated square.
  • Subtitle bitmaps: map their own canvas.
  • Icon masks and the watched-mark veil: generated at the aspect of their box.
  • glassload: a synthetic noise texture, passes UV_FULL.

Tests, RED then GREEN

New tests:

  • ui/mod.rs: cover_uv_crops_a_portrait_vertically_riding_high_for_a_headshot, cover_uv_crops_a_landscape_horizontally_and_centred, cover_uv_is_the_identity_at_matching_aspect_and_for_an_undecoded_source
  • gfx.rs: a_crop_composes_under_the_padding_and_the_full_window_is_its_identity
  • ui/widgets_art_crop_tests.rs (the consumer seam, using RowStyle::CAST): a_portrait_headshot_on_the_cast_row_is_cropped_not_squashed, plus the crop-per-variant test and the identity/fallback test

For RED, the mapping was stubbed back to the old whole-texture behaviour:

cast headshot drawn with uneven scale 1.5789474 x 2.368421 (uv [0.0, 0.0, 1.0, 1.0])
test result: FAILED. 3 passed; 4 failed; 0 ignored; 0 measured; 4353 filtered out

GREEN:

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 4353 filtered out; finished in 0.01s

Simulator captures

Taken in the host simulator against the synthetic tests/mock_pms.py. A local-only, uncommitted driver served people photos as synthetic 2:3 portraits: a pale disc high on the frame over a dark band, cover-scaled the way PMS does it. No real account and no real photos. For the "before" capture, cover_uv was stubbed to the old whole-texture behaviour.

  • Cast row: the disc is a flat ellipse before and a round circle after, sitting high in the circle.
  • Person page portrait: same result.

Gates (on the committed tree, 85df74b)

  • make check lib stage: test result: ok. 4359 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 54.35s
  • make check hostsim stage: test result: FAILED. 4410 passed; 2 failed; 1 ignored. Both failures are EAGAIN/WouldBlock (os error 35) in loopback-socket fixtures: plex::library::tests::show_preferences_fail_fast_without_retrying_errors and app::run::lifecycle_regression_tests::did_background_prevents_due_up_next_from_launching_while_suspended. Neither is in code this change touches, and both pass when re-run on their own. Across three full runs, the other failures were a curlio teardown timing test and the same plex::library fixture, each hit only under host load. So make check did not exit 0 on this machine.
  • CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features: Finished, clean
  • make (ARM): exit 0
  • git status --short: empty before and after

Review

An independent adversarial review of the branch diff: verdict approve, no material findings.

Not yet verified

TV verification is pending: LG rasterization of the cropped circles, and the on-device look of real non-square headshots.

🤖 Generated with Claude Code

…retching

Every image is fetched as a `minSize=1` photo transcode, which COVERS the
requested box rather than fitting it, so a texture carries its SOURCE's
aspect. The art-tile draw sampled the whole texture into the tile's rect
regardless, so a 2:3 headshot asked for at 300x300 (decoded 300x450) was
squashed to two-thirds of its height in the cast row's circle, and the same
held for every other tile whose art was not its box's shape.

The shared image draw now takes a UV window: `Rect::cover_uv` computes the
aspect-preserving cover crop (sides evenly for a wider source; a taller one
by `Crop` - even, or `Headshot`, which takes a fifth of the overflow off the
top so faces stay in frame), and gfx composes it under the card composite's
shadow-padding remap. `widgets::card` - the one draw every art tile goes
through - resolves the texture WITH its decoded size and crops by `art_uv`;
the profile chip avatar and the player info panel's still do the same. The
id-only `resolve_tex`/`resolve_tex_on` are removed, so no picture can be
resolved without the size it needs to be drawn undistorted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T01:38:31.484869Z 150377a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85df74b629

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +200 to +203
/// **The size is not optional, which is why this is the only resolver.** Every image is fetched as
/// a `minSize=1` transcode, which COVERS the requested box rather than fitting it, so a texture's
/// aspect is the SOURCE's and not the box's; a picture drawn into its frame without it is
/// stretched. [`card`] turns it into a crop ([`art_uv`]), a backdrop into an overflow

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile the documented transcode contract

This new invariant says minSize=1 preserves the source aspect, but docs/pms-api.md:720-733 still instructs callers to add upscale=1 and says the verified response is cropped to exactly the requested dimensions. That contract would make tw/th equal the tile aspect and turn this crop into an identity operation, so a future caller cannot tell whether omitting upscale is intentional or safely follow the API guide without defeating this fix. Update the image API section to document the request actually used here and its observed output dimensions.

AGENTS.md reference: AGENTS.md:L97-L99

Useful? React with 👍 / 👎.

…'s cover shape

No code sends upscale=1, and minSize=1 fills the box keeping the source's
aspect rather than cropping to exactly w x h - which the draw-time cover crop
depends on. Marked unverified against a real PMS; the size table now lists the
boxes the app actually requests and how each consumer maps a mismatched aspect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 79c2d35 into main Sep 25, 2026
6 of 7 checks passed
@GLinnik21
GLinnik21 deleted the fix/art-aspect-cover-crop branch September 25, 2026 01:55
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
The note gains the image-subtitle fix, the trailer stop/reporting/redirect
behaviour, the art-crop, library-seat and profiles read-out fixes, and a
line for nightly users about BACK from the player. The audit records the
seven changes as host-verified and pending the device pass, the bundled
FFmpeg's new libz.so.1 dependency with its firmware evidence, and the
https HLS cross-origin redirect gap as a known follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
…brary firmware gate (#241)

* docs: correct two claims #235 and #239 left stale

ci/build-ffmpeg.sh: the firmware database fwsym holds spans platform
releases 1.2.0 to 11.2.0, not webOS 3 to 10; libz.so.1 is in every image.
docs/trailer-ux-plan.md: the deferred just_finished proposal names the
preview machine's current transitions, Machine::eos and Machine::stopped,
as docs/TODOS.md already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 release note and audit: cover #234-#240

The note gains the image-subtitle fix, the trailer stop/reporting/redirect
behaviour, the art-crop, library-seat and profiles read-out fixes, and a
line for nightly users about BACK from the player. The audit records the
seven changes as host-verified and pending the device pass, the bundled
FFmpeg's new libz.so.1 dependency with its firmware evidence, and the
https HLS cross-origin redirect gap as a known follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: the audit lint refuses an unfilled placeholder in the authored half

Nothing substitutes into a release audit's authored half; gen-release-audit
only replaces the generated block, so a __PLACEHOLDER__ left there
publishes literally. Watched red on the v0.7.0 audit's __GATES__ row before
it was filled; every existing audit and the template pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: record the gates run on the release-prep tree

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: fold in the second device pass over #234-#240

#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 release note and audit: #242 fixes the device pass's Sign-out focus finding

The audit lists #242 among the changes landed after the device pass,
host-verified and pending the device, and marks #237's focus-on-Sign-out
finding fixed by it. The note's smaller fixes gain the menu-focus line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: the gate row names the tree rebased onto #242

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 note and audit: scope the trailer and library promises, record the pass's account writes

Review findings on #241:
- A trailer started with Play Trailer is an ordinary playback
  (request_play, preview: false) and reports a timeline; only the
  background preview, full-screen mode included, never reports.
- The library DOWN fix holds only when the reader has not moved before
  the shelves load.
- The device-pass summary counts #236 as passed only for shelves-first.
- The pass wrote to the Guest profile: the explicit PGS pick's
  PUT /library/parts selection, and the harness's unscrobble, progress
  seeds and playback timelines.
- The gate row states that every commit after b99e79f is note/audit
  only and which checks were re-run on the head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fwcompat: grade the bundled FFmpeg libraries, and put their DT_NEEDED in the audit

#235 gave libavformat-plx a DT_NEEDED on libz.so.1, and nothing graded it:
the libraries are dlopen'd, webosbrew-ipk-verify grades only the app and
service executables, and fwcompat on a bundled library reported every
firmware FAIL for the sibling libav*-plx names no firmware carries.

tools/fwcompat.py --shipped DIR takes DT_NEEDED names that are files in DIR
off the firmware's list and counts what they export as resolved. Watched:
bare, libavformat-plx FAILs everywhere on its siblings; with --shipped pkg
all three pass from 4.4.2 to 11.2.0; against a copy of the 4.4.2 database
with libz removed it FAILs on libz.so.1 (4 symbols) and exits 1.

CI's firmware load matrix and the build's fwcompat gate now run it over
each bundled library; the build appends the matrix to pkg/ipk-verify.md,
which gen-release-audit.py embeds, and gen-release-audit.py lists each
bundled library's DT_NEEDED. Review finding on #241: the zlib verdict is
now read from the published package instead of typed into the audit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: the zlib entry defers to the generated half; the gate row names the tooling commits

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fwcompat review: row() takes its cells, and --shipped says what it trusts

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build-package: the bundled-library matrix goes into ipk-verify.md unfenced

gen-release-audit.py already wraps that whole file in one code fence; a nested
fence closed it. Only the step summary fences the aligned columns now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant