Follows the page-only scan of the retained canvas:
- Pattern sources come from every paint a layer draws with: its fills
and strokes, and also its vector regions' own fills and its text runs'
own fills. Before, the scan read only fills and strokes, so an edit to
the source of a region's or a run's pattern left the canvas stale
unless that source also filled an ordinary layer somewhere in the file.
- A layer inside pattern sources is walked once, so a real tree stays
within the walk's budget of three visits a layer.
- A child list that repeats (a hostile file) runs out the budget; the
scan then counts every layer of the file, as it did before the page
scan, instead of what it had reached.
New tests: glass and a small blur on the page with a wider blur on
another page (full renders, a pan, an edit and band-by-band renders
against render_view), a looping child list over blurs, and a vector
region filled with a pattern from another page. Each fails with its
part of this change taken out.
The explanations of render_part, render_bands, render_columns and
band_overlap now sit on the functions the canvas calls.
large_doc_digests prints the same digests as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each box pass divided four channel sums by the box's width for every
pixel. The width is the same along a row, so the division becomes a
multiply by its rounded-up reciprocal and a shift, exact for every sum a
box can hold (at most 255 times its width); widths past 2^23 pixels,
which no blur reaches, keep the division. The bytes are the ones the
reference blur gives (blur_matches_the_reference_bytes), and a new test
checks every quotient for box widths up to 4,001 and the widest ones.
blur_timings, release, Apple M5 Pro, best of runs alternating the two
builds (ms, before -> after):
| pixmap | sigma | parallel | one thread |
|---|---:|---:|---:|
| 1700 x 1200 | 48 | 2.28 -> 2.09 | 24.16 -> 16.52 |
| 1700 x 1200 | 12 | 2.32 -> 2.11 | 23.24 -> 15.89 |
| 600 x 400 | 6 | 0.49 -> 0.39 | 2.71 -> 1.88 |
One thread is how a band of a parallel render and the browser blur.
Whole frames gain less. large_doc_timings, the page with a background
blur and a glass pane, minimum of 10 alternating runs at a load average
under 4 (ms, before -> after):
| frame | blur here |
|---|---:|
| scan after an edit | 0.77 -> 0.78 |
| edit one layer | 8.01 -> 6.90 |
| zoom (100%) | 17.45 -> 16.60 |
| zoom (400%) | 29.26 -> 29.56 |
| pan 60 px | 3.05 -> 2.80 |
The 400% zoom is unchanged: most of it is not the box passes.
pan_render_timings, zoomed_card_timings and glass_render_timings move
by no more than run-to-run noise. large_doc_digests and glass_digests
print the same digests as before.
Tried and left out: drawing a blur reaching past a band in fewer, taller
bands rather than in one piece (zoom at 400% with the blur: 29.1 ->
37.5 ms, as a blur on a band's thread is not split across threads), and
splitting the box loop into its edges and middle (no change measured).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What the retained renderer works out about a page (grainy layers to
redraw whole, pattern sources whose edits show, the largest backdrop
blur) came from passes over every layer of the file, after every edit
and before every zoom. It now comes from one walk down the page shown,
following the pattern sources it fills with wherever they are (and the
sources those fill with). A zoom reuses what the last render found for
the same document, page and fonts.
Partial renders, the canvas's full renders and the browser's banded
renders take the page's backdrop radius, so a blur on another page no
longer widens pan strips and patch margins, and no longer stops a full
render from drawing in parallel bands. render_view keeps the file's
radius.
Release timings on an Apple M5 Pro, 100,000 layers on five pages,
1600 x 1100 px, minimum of 8 runs alternating the two builds (ms,
before -> after; the machine was shared with other builds):
| frame | cards | blur here | blur elsewhere | flat |
|---|---:|---:|---:|---:|
| scan after an edit | 3.11 -> 0.80 | 3.09 -> 0.79 | 3.27 -> 0.79 | 3.07 -> 0.82 |
| edit one layer | 5.31 -> 2.77 | 10.57 -> 7.95 | 7.43 -> 2.79 | 7.06 -> 3.30 |
| zoom (100%) | 9.60 -> 6.67 | 20.62 -> 17.85 | 13.53 -> 6.71 | 6.72 -> 3.61 |
| zoom (400%) | 5.78 -> 2.75 | 32.62 -> 29.42 | 18.04 -> 2.77 | 5.86 -> 3.03 |
| pan 60 px | 0.69 -> 0.70 | 3.05 -> 3.10 | 2.16 -> 0.69 | 2.84 -> 2.95 |
large_doc_digests hashes 65 frames of pans, edits and zooms over five
scenes (pattern fill with an off-page source, noise, background blur,
glass included); both builds print the same digests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five pages of 20,000 layers: cards, cards with a background blur and a
glass pane on the page shown or on another page, and a flat page. Rows
time the retained renderer's scan after an edit, an edit, a zoom at 100%
and 400% and a 60 px pan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An image fill shown at half its pixels or fewer (a 0.5x export, the canvas zoomed out) was sampled straight at that size with bicubic filtering and nothing averaging the pixels between samples, so fine detail aliased into moiré bands. It now draws from a copy averaged down to under twice the size it shows at (the image halved, or the canvas's smaller copy halved), cached like the canvas's copies. Every copy averages the finished pixels (premultiplied, after the image's adjustments) and is placed where the image itself would be; the size shown is measured on the axis showing the most device pixels, so an image squeezed on one axis by its crop or its layer keeps the other's pixels. Images shown larger draw as before.
Fixes#2664.
The ring stroke moved into draw::ring on main; its round-corner guard keeps this
branch's corner-style check. pt-BR.toml goes back to main's: translations are
added in storytold/craft-i18n, and this branch had renamed "Individual corners"
to "Ajustes da borda" (edge settings).
A sharp drop shadow under a stroked layer (text with an outside stroke most visibly) showed a light outline along the layer's edge wherever that edge lay over the shadow. Hiding the shadow behind the layer cut the layer's share of each anti-aliased edge pixel out of the shadow, then the layer's edge pixel drew that share again: the edge counted twice. The shadow now keeps its part outside the layer scaled by what the layer lets through there, the outlines it is cast from and hidden behind follow what the layer fills (#2635), and stroked text casts and hides its shadows by its outlines too (#2631).
main's canvas keeps the texture's pixels (the eyedropper reads them) and its
worker marks an image that leaves layers out. A render handed over as patches
puts them on that kept copy as on the texture, and carries the mark.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An opaque inside stroke showed the fill through its anti-aliased outer edge, a thin light line on a dark background, and an outside stroke let the background show between it and the fill. Where the stroke hides what is under it, the fill now reaches the middle of the stroke (#2635).
Review of #2592. A tolerance of a billionth of the coordinate is a hundredth of a unit at ten
million units: a visible move there could be taken for noise. 64 ulps is above what the box
following a point adds and under a pixel anywhere on the page.
Every finished render was converted to a texture image and uploaded whole: after an edit that
redrew a part of the view, all of the view and its margin again, every frame of a drag. The
retained renderer now says where a patched image differs from the one before (nothing after a
full render or a pan, which moves every pixel), the browser's worker numbers its images and is
told which one the canvas's texture holds, and a render that only patches that image hands over
the patches, which go onto the texture in place. The image around the view and the desktop's
render thread hand over whole images, as before.
A re-rendered area was cut out of its render into a pixmap of its own, and that drawn onto the
kept image: two more passes over the area, which for simple content took far longer than
rendering it. Its rows are now copied straight into place.
A 4.7 megapixel patch of two flat fills (a 4112 x 2292 view, release, one thread): 16.9 -> 2.8
ms a frame.
Review of #2592. A vector's strokes are as wide on the page as its transform makes them: when
anything but where the layer lies changed in the transform, every stroke changed, whether its
path moved or not, so the vector is drawn again whole. Points count as moved past float noise
relative to their coordinates (1e-9), not past a fixed ten-thousandth of a unit; and a stroke's
reach on the page goes by the most the transform stretches a length, which under a skew is
more than either axis is stretched.
Review of #2590. The area a spread shadow shows in was sized by the transform's area scale: a
layer stretched one way and squeezed the other spreads further that way than that. It now goes
by the most the transform stretches a length. And the pixmap a shadow is blurred in may be a
blur's reach wider than the widest pixmap: across a 16,384 pixel view it was refused, and the
shadow left out.
Close up, the view (or the band or patch of it being drawn) lies inside its clipping frames.
Each still copied the pixmap, filled a mask for it and put the copy back through the mask,
pixel by pixel: a frame with an edge off screen on a fraction of a pixel never took the
whole-pixel path. Now a clip that takes in the whole pixmap draws its children as they are;
edges at or past the pixmap's count as whole; and rows of a mask that are all in or all out are
copied or kept in one piece.
A view inside four nested clipping frames at 1,933% on a 2x display (4112 x 2292, release, one
thread): 119 -> 87 ms, a band of it 18 -> 12 ms.
A point dragged in the vector editor changed the vector, so its whole box was drawn again.
Zoomed to the vector (as the editor does) that is most of the view, past the share a patch may
cover: every frame of the drag was a full render, drawn in bands over several frames. A
vector that differs only in where its points and handles are now redraws the segments that
moved and their neighbours (joins and rounded corners follow them), as far out as its stroke
reaches. Dashes, width profiles, brushes, gradients and images, effects, masks and open filled
paths depend on the whole outline: those are drawn again whole, as before.
A layer with a drop shadow was drawn with the shadow's reach around the pixmap (1,392 pixels
each way for a 16 px blur at 1,933% on a 2x display) and the shadow blurred from a copy of
all of it, once for every band of a full render. A shape or frame with opaque paints now
casts its shadows from its outline: only over the pixels that show, and a blur of 8 device
pixels or more is drawn smaller, blurred and scaled back up, on a grid that follows the shape so
bands, patches and whole views agree. A frame that doesn't clip (a stack) counts while
everything its children paint stays inside its box; its shadows that spread still come from
its pixels, as they did.
zoomed_card_timings (release, one thread, 4112 x 2292): the view in 8 bands 4576 -> 152 ms,
the slowest band 598 -> 21 ms.
SVG, PNG, PDF and Vector Drawable exports took their size from the
renderer's bounds, and Node::outline_reach grows a line's, vector's or
polygon's box by the weight times the miter limit (up to 4) to leave room
for a mitre at any corner. An icon frame whose outlined strokes stay
inside it exported at 26 x 26 to 30.8 x 24 instead of 24 x 24, its content
moved off the frame's origin.
export_bounds now walks the tree as world_render_bounds does
(Document::world_render_bounds_with) and measures each layer's own paint
on the outlines it draws: its shape and its stroke area from stroke_fill,
in page space, grown by its effects. A dashed stroke counts as a solid one
as well as its dashes, so where the dashes fall doesn't change the size.
Text and drop shadows with a spread keep the renderer's bounds. The
renderer's own bounds, used for drawing and culling, are unchanged.
Shrinking outline_reach itself was rejected: the renderer culls and
caches by it, and an exact stroke there would cost a stroke outline per
layer per bounds query.
* M6: restore full JPEG export chroma
* M6: check the JPEG matte away from the painted edge
* docs: keep the parity header's change level and describe the JPG chroma fix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>