Skip to content

Stop Pixels painting a moved card's shadow as an amber slab - #5550

Merged
max-sixty merged 1 commit into
mainfrom
grind/4039
Nov 9, 2026
Merged

max-sixty merged 1 commit into
mainfrom
grind/4039

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

The Pixels view of an lf-shot painted every changed pixel at least alpha 40, about 16% amber. The theme's soft shadows, --raise-1 and --raise-2, redraw a moved box's gradient a level or two at a time, so that floor turned a shadow into a banded amber slab around the box. The mask's alpha now rises linearly from 0 to opaque at 96 levels of channel distance, so an edit under about 10 levels paints below 10% amber.

This partly reverses #3820, which adopted BlazeDiff with threshold 0 and anti-aliased pixels kept, and kept the floor, so that a one-level deliberate edit stayed visible in Pixels. A one-level edit is still in the mask (alpha 3), the "one level is a change" tests still pass, and the reading still calls such a pair "only slight changes", but a reader won't see it in Pixels. This is option (b) on #4039, taken as a call Max may reverse, since with Pixels' settings BlazeDiff did nothing a plain comparison doesn't. The module header records the decision and its reason.

With its threshold at 0, BlazeDiff marked exactly the pixels that a plain comparison marks ("the two pixels differ, unless both are fully transparent"). Checked per pixel against main's changedPixels on the three card pairs below, on 200,000 random pixels (translucent and transparent ones included) and on a 1440x900 pair: zero pixels differ. So changedPixels is now that comparison, and synchronous. @blazediff/core goes, with its types patch, its build/vendor.mjs row, build/entries/blazediff/, the vendored bundle and its licence notice, its compiler path, the padding helper, and the special case for BlazeDiff's checkerboard background (with the test case that guarded it). The lock loses only BlazeDiff's entries, and pnpm run build:browser regenerated the compiler paths and nothing else.

Evidence

uv run leaf-dev probe .tmp/4039/pair.html --journey .tmp/4039/measure.py --browser {chromium,firefox} --base opens each pair's Pixels view and reads back the mask the widget painted. Each pair is a real triage-board card captured before and after moving 3 px down, in three faces. The counts are mask pixels at 10% amber or more (alpha ≥ 26), main and then this branch, and they're identical in Chromium and Firefox:

Card face main this branch
resting, no shadow 7,681 6,964
--raise-1 11,049 6,792
--raise-2 17,075 6,766

On main the shadow adds 3,368 and 9,394 visible pixels; on this branch it adds none. The set of marked pixels (any alpha) is identical between the arms, and the 3,137 opaque pixels of the card's text and edges are unchanged.

The stills, one sheet per engine with rows for the three faces and columns for main and this branch, cropped and scaled 3x, are in the worktree at .tmp/4039/sheets/4039-pixels-{firefox,chromium}.png. On main the --raise-1 and --raise-2 cards sit in a wide, banded tan slab. On this branch both look like the resting card: amber text and a thin amber band at the top and bottom edges where the card moved.

Computing the mask for a 1440x900 pair takes a median of 4.7 ms on this branch and 8.9 ms on main (Node, three interleaved rounds of nine), since one pass replaces BlazeDiff's pass plus a second.

Tests

  • pnpm run check passes (815 runtime tests, the browser build check, the Worker tests).
  • node --test tests/runtime/image-difference.test.mjs: 20 pass. The one assertion that changed is the exact alpha of a 25-level edit, now 66 where it was 96. A bug-back run flipped each rule changedPixels keeps (the floor, the transparent-colour exemption, alpha, the row stride for unequal widths); each fails a test, and the unflipped control passes.
  • uv run pytest tests/browser/test_render_commands.py -k "shot or pixels": 16 pass, covering the Pixels press, mask ordering and replacement. Also tests/browser/test_render_visual_review_journey.py -k evidence_height: 1 pass.

Not verified

WebKit, and dark-scheme pages. The amber's visibility at a given alpha depends on the greyed image under it; the 10% line is a judgment, not a measured threshold of perception.

Closes #4039

This was written by Claude Code on behalf of max-sixty

The Pixels view of an lf-shot painted every changed pixel at least alpha 40 (about
16% amber). The theme's soft shadows, `--raise-1` and `--raise-2`, redraw a moved
box's gradient a level or two at a time, so that floor turned a shadow into a banded
amber slab around the box. The mask's alpha now rises linearly from 0 to opaque at 96
levels of channel distance. An edit under about 10 levels now paints below 10% amber.

This partly reverses #3820, which adopted BlazeDiff with threshold 0 and anti-aliased
pixels kept, and kept the floor, so that a one-level deliberate edit stayed visible in
Pixels. Such an edit is still in the mask (alpha 3), the "one level is a change" tests
still pass, and the reading still calls the pair "only slight changes", but a reader
won't see it in Pixels. The module header records the decision and why.

With its threshold at 0, BlazeDiff marked exactly the pixels that a plain "the two
pixels differ, unless both are fully transparent" comparison marks: the same set on
the three card pairs below in Chromium and Firefox, on 200,000 random pixels
(translucent ones included), and on a 1440x900 pair. So `changedPixels` is now that
comparison, and synchronous. `@blazediff/core` goes, with its types patch, its
`build/vendor.mjs` row, `build/entries/blazediff/`, the vendored bundle and its
licence notice, its compiler path, the padding helper, and the special case for
BlazeDiff's checkerboard background (with the test case that guarded it).

Measured with `leaf-dev probe .tmp/4039/pair.html --journey .tmp/4039/measure.py
--base`, which opens each pair's Pixels view and reads back the mask the widget
painted. The pair is a real triage-board card moved 3 px, in three faces. These are
the mask pixels at 10% amber or more, main then this branch, identical in Chromium
and Firefox:

- resting card, no shadow: 7,681 then 6,964
- `--raise-1`: 11,049 then 6,792
- `--raise-2`: 17,075 then 6,766

The set of marked pixels (any alpha) is identical between the arms, and the 3,137
opaque pixels of the card's text and edges are unchanged. On main the shadow adds
3,368 and 9,394 visible pixels; on this branch it adds none. Computing the mask for a
1440x900 pair takes a median of 4.7 ms on this branch and 8.9 ms on main (Node, three
interleaved rounds of nine), since one pass replaces BlazeDiff's pass plus a second.

The one runtime assertion that changed is the exact alpha of a 25-level edit, now
66 where it was 96.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty marked this pull request as ready for review November 9, 2026 08:18
@max-sixty
max-sixty merged commit 90e3d79 into main Nov 9, 2026
7 checks passed
@max-sixty
max-sixty deleted the grind/4039 branch November 9, 2026 08:25
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.

Decide whether Pixels should soften redrawn-shadow fringes

2 participants