Repository navigation
Stop Pixels painting a moved card's shadow as an amber slab - #5550
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 9, 2026 08:18
leaf-agent
approved these changes
Nov 9, 2026
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.
The Pixels view of an
lf-shotpainted every changed pixel at least alpha 40, about 16% amber. The theme's soft shadows,--raise-1and--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
changedPixelson the three card pairs below, on 200,000 random pixels (translucent and transparent ones included) and on a 1440x900 pair: zero pixels differ. SochangedPixelsis now that comparison, and synchronous.@blazediff/coregoes, with its types patch, itsbuild/vendor.mjsrow,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, andpnpm run build:browserregenerated the compiler paths and nothing else.Evidence
uv run leaf-dev probe .tmp/4039/pair.html --journey .tmp/4039/measure.py --browser {chromium,firefox} --baseopens 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:--raise-1--raise-2On 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-1and--raise-2cards 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 checkpasses (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 rulechangedPixelskeeps (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. Alsotests/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