Repository navigation
[CTX-1374] fix(rich): keep fill cover inside the image on HiDPI - #2283
Merged
Merged
Conversation
The Fill arm of fit_plan scored the cover ratio against the DPI-scaled native size and then derived the source window as dest / factor, so the window came out dpi times too large. It ran past the image and the rasterizer's clamp(0, iw-1) turned the overshoot into clamped smear bands, shrinking the visible image to 1/dpi of the width. Cover is scale invariant, so score it against the raw image size; center/tile keep their DPI scaling. Adds DPI-pinned unit tests (cover/contain geometry, no clamp smear, arm swap guard) and a headless runtime pixel-coverage test at apply_dpi_scale(1.6, 2506x1496).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 19, 2026
Closed
Xuepoo
added a commit
that referenced
this pull request
Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes: all 71 merged commits are grouped under Added, Changed, Fixed, Security, and Documentation, with PR numbers and the affected CTX tasks. Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line paste duplication and ghost fixed by the cursor clamp across wide spacers (#2272), combining marks paint so decomposed `é` matches precomposed (#2279), kitty font query and `bitty +show-font` (#2277), bounded native clipboard acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the `bitty.history` Lua surface (#2268), the production ComponentBroker plus activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor reservation (#2289). Partials are marked honestly: #2254's request surface is still pending, the #2213 disposition stays open, #2286 is feature-gated and unwired, the macOS clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not claimed because PR #2292 is unmerged. The heading reads `unreleased` because the release is on hold; the tag date is set at tag time. Docs-only: no code, scripts, workflows, or pins touched.
Xuepoo
added a commit
that referenced
this pull request
Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes: all 71 merged commits are grouped under Added, Changed, Fixed, Security, and Documentation, with PR numbers and the affected CTX tasks. Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line paste duplication and ghost fixed by the cursor clamp across wide spacers (#2272), combining marks paint so decomposed `é` matches precomposed (#2279), kitty font query and `bitty +show-font` (#2277), bounded native clipboard acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the `bitty.history` Lua surface (#2268), the production ComponentBroker plus activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor reservation (#2289). Partials are marked honestly: #2254's request surface is still pending, the #2213 disposition stays open, #2286 is feature-gated and unwired, the macOS clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not claimed because PR #2292 is unmerged. The heading reads `unreleased` because the release is on hold; the tag date is set at tag time. Docs-only: no code, scripts, workflows, or pins touched.
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 #2278 (0.0.24 runtime matrix finding 4). The matrix run reported that
window.background_fit = "fill"letterboxed with smeared edge bands whilefitcovered the window, i.e. the modes looked swapped.They are not swapped.
fit(contain) was already correct.fill(cover)double-counted the window DPI factor:
fit_planscored the cover ratio againstthe DPI-scaled
native_w/native_hand then derived the source window asdest / factor, which isdpix too large. The window ran past the image, andrasterize_background'sclamp(0, iw-1)turned the overshoot into the smearbands, shrinking the visible image to
1/dpiof the width.On the reporting host (
dpi = 1.6, surface2506x1496, wallpaper3840x2160) the plan wassrc = [-974.5, 0, 5789.0, 3456.0]; the documentedcover is
src = [110.86, 0, 3618.29, 2160.0].fitonly looked coveredbecause the window aspect (1.675) is close to the wallpaper aspect (1.778),
leaving a 43 px letterbox.
Change
crates/bitty-rich/src/background.rs— cover is scale-invariant, so the ratiouses the raw image size.
center/tilekeep their intended DPI scaling.Tests
fit_plan_fill_covers_within_image_bounds_at_any_dpi: cover stays insidethe image, crops evenly, and is scale-invariant across dpi 1.0-3.0.
fit_plan_fit_is_contain_at_any_dpi: contain letterboxes the full image atevery dpi.
fit_plan_fill_and_fit_are_not_interchangeable: mutation guard against anarm swap.
rasterize_fill_at_hidpi_does_not_clamp_edge_pixels: exact 2x upscale, noclamp smear.
window_fill_cover_stays_inside_the_image_at_hidpi(bitty-runtime):headless present path at
apply_dpi_scale(1.6, 2506x1496); probes green/red/blue thirds - fails on the pre-fix code (
36 %probe reads the green smearband instead of red).
Mutation evidence: restoring the DPI double-count fails 4 tests; swapping the
fill/fitarms fails 5.Verification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo nextest run -p bitty-rich -p bitty-runtime --lockedcargo check --target x86_64-pc-windows-gnu --workspace --all-targetsEvidence (gitignored):
recording/background-fit-geometry/- productscreenshots, headless before/after renders, smear-run and coverage numbers.
Priority: P2 | Area: render | Labels: bug,P2,area:render | Milestone: 0.0.24 | RFC: OQ-042 | Task: CTX-1374
Closes #2278