200 Commits
Author SHA1 Message Date
BFlat 23a874a8c6 Merge pull request #2706 from brytoncooper/perf/render-navigation-1250
M8: page-scoped retained scan, zoom reuse, and reciprocal multiply-shift box blur (#1250)
2026-11-28 19:53:59 +07:00
Bryton CooperandClaude Opus 5.5 f603d964a0 M8: the page scan counts every paint and falls back on a looping file
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>
2026-11-28 05:17:44 -07:00
Bryton CooperandClaude Opus 5.5 5ee57340e1 M8: a blur divides its box sums by a multiply and a shift (#1250)
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>
2026-11-28 05:05:17 -07:00
Bryton CooperandClaude Opus 5.5 6529c9240b M8: the retained canvas looks only at the page it draws (#1250)
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>
2026-11-28 04:41:02 -07:00
Bryton CooperandClaude Opus 5.5 0b5f079c0d M8: navigation timings in a 100,000-layer file
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>
2026-11-28 04:27:25 -07:00
bflatastic 2d7370017c Merge remote-tracking branch 'origin/main' into HEAD 2026-11-28 17:26:19 +07:00
BFlat f184f85a33 Merge pull request #2673 from storytold/fix/2664-image-downscale
M8: a downscaled image is filtered, so fine detail doesn't turn into moiré
2026-11-28 16:20:26 +07:00
bflatastic 86092cddda Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	contributors/people.toml
2026-11-28 15:45:40 +07:00
bflatastic e9a5986e69 M8: a downscaled image is filtered, so fine detail doesn't turn into moiré
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.
2026-11-28 15:41:42 +07:00
Bryton Cooper d9deec7b12 perf(doc): share TextData and VectorNetwork copy-on-write via Shared<T> (#1819) 2026-11-28 01:27:27 -07:00
FredApps add4e27b4b Merge branch 'main' into codex/native-corner-styles
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).
2026-11-28 07:47:21 +01:00
FredApps 3e44fd805a Merge branch 'main' into perf/partial-upload 2026-11-28 07:38:30 +01:00
bflatastic 7a5a7b772c M8: a drop shadow of an outside-stroked layer is one solid silhouette
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).
2026-11-27 16:49:58 +07:00
Livio SidlerandClaude Fable 5.2 efed22afd9 Merge main: the gaps list after the other M8 changes landed
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 10:11:49 +01:00
Livio SidlerandClaude Fable 5.2 5c1f4c5462 Merge main: patches go on the image kept for the eyedropper, and a drag's base render says what it skips
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>
2026-11-27 10:08:34 +01:00
bflatastic 10789a2fb8 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 16:05:40 +07:00
bflatastic a9dce94327 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 16:05:17 +07:00
bflatastic ccd892cc8f Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 16:04:47 +07:00
BFlat 2527ce5a81 Merge pull request #2650 from storytold/fix/2635-stroke-fringe
M8: a stroke's edges meet what is behind it and the fill, with no light fringe
2026-11-27 15:47:30 +07:00
bflatastic d654660c25 M8: a stroke's edges meet what is behind it and the fill, with no light fringe
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).
2026-11-27 14:51:33 +07:00
bflatastic 41513f0838 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 14:24:16 +07:00
bflatastic 2430b8036d Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 14:23:54 +07:00
bflatastic 4ef95da6a5 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 14:23:31 +07:00
bflatastic 0210633552 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/gaps.md
2026-11-27 14:23:04 +07:00
Livio Sidler 1de507c434 M8: moved points are told from float noise by ulps, not by a share of their coordinate
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.
2026-11-24 13:39:17 +01:00
Livio Sidler 3cbc4d0031 M8: the browser's canvas uploads only what an edit changed of its image
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.
2026-11-24 13:02:00 +01:00
Livio Sidler 810b8dc594 M8: a patch goes into the kept image row by row
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.
2026-11-24 12:50:52 +01:00
Livio Sidler 03e20611b1 M8: a moved point of a vector whose transform changed redraws all of it
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.
2026-11-24 12:40:34 +01:00
Livio Sidler 15a8c15bcd M8: an outline shadow's spread reaches as far as its layer is stretched, and one shows across the widest view
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.
2026-11-24 12:37:03 +01:00
Livio Sidler 11da741c49 M8: a clipping frame that takes in the whole pixmap costs no layer, mask or copy there
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.
2026-11-24 12:31:10 +01:00
Livio Sidler 0a4f57edce M8: a moved point redraws its vector around it only
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.
2026-11-24 12:21:25 +01:00
Livio Sidler e34724047d M8: a drop shadow of an opaque shape is drawn where it shows, at the resolution its blur needs
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.
2026-11-24 12:05:40 +01:00
Denis Gomes 81eb01e821 M8: a layer exports at the size of what it draws, strokes as drawn
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.
2026-11-24 02:32:28 -05:00
Dylan M. Taylor 8320b6699e render,format: finish craft-image-codecs cutover and ICC/GIF/bounds parity tests (#2526) 2026-11-20 13:02:48 -05:00
f7acb637f0 M6: restore full JPEG export chroma (#2521)
* 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>
2026-11-20 21:28:36 +07:00
Dylan M. Taylor 48ebd1b58b fix(render): clamp non-finite samples in thumbnail_f32 (#2525) 2026-11-20 08:06:16 -05:00
Dylan M. Taylor d4d4b5760a render: preserve float thumbnail precision and verify output/ICC parity (#2518)
* render: preserve float thumbnail precision and add output/ICC parity tests

* test: match integer un-premultiplication in export_output_and_icc_parity
2026-11-19 23:55:48 -05:00
FredApps e97b644a39 Merge pull request #2515 from Terra854/fix/u16-thumbnail-precision
Preserve 16-bit precision when scaling thumbnails
2026-11-20 08:49:24 +07:00
Terra854 11bfa4db58 M8: preserve 16-bit thumbnail precision 2026-11-20 07:27:16 +08:00
Terra854 3120523acc M8: preserve stored raster orientation 2026-11-20 06:53:33 +08:00
Dylan M. Taylor 4e35fb9cea render: use shared raster decoding and export (#2501)
* render: use shared raster decoding and export

* render: fix Cow<Image> ownership and run cargo fmt
2026-11-19 14:00:49 -05:00
FredApps e2aa302165 Merge remote-tracking branch 'origin/main' into fix/present-hidpi-detail-2127
Signed-off-by: FredApps <153173854+FredApps@users.noreply.github.com>

# Conflicts:
#	docs/prototyping-parity.md
#	docs/target-app-parity.md
2026-11-18 16:41:47 +07:00
bflatastic 3451d42118 M8: a test that a textured layer renders the same in column and row bands 2026-11-17 17:43:41 +07:00
bflatastic 3c92930224 M8: the strips a pan uncovers render in parallel bands, as full renders do 2026-11-17 17:14:57 +07:00
Trevor BrownandClaude Sonnet 5.5 d851ac07f0 Merge upstream main into fix/present-hidpi-detail-2127
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-12 19:39:16 -05:00
bflatastic 6bbd92856c Merge main into #2224 2026-11-12 11:24:51 +07:00
BFlat db63355da8 Merge pull request #2232 from denisg0mes/zoomed-out-image-copies
M8: zoomed-out images draw from small copies that stay decoded
2026-11-12 11:14:10 +07:00
bflatastic 0c5bbc07a7 Merge main into #2224 2026-11-12 11:03:16 +07:00
bflatastic cf28715c18 Merge main into #2221 2026-11-12 10:47:13 +07:00
bflatastic a46e696e71 Merge main into #2133 2026-11-12 10:27:25 +07:00