223 Commits

Author SHA1 Message Date
Codex d968e3eece Keep uncommon format conversion on desktop to fit the browser budget 2026-11-30 02:19:42 +01:00
BFlat b8155c5301 Merge pull request #2754 from hoangquocvietuet/fix/2567-text-run-blend
M3: a text run's blend fill in a shadowed pass-through frame blends with the backdrop (#2567)
2026-11-30 00:09:51 +07:00
hoangquocvietuet ebf39d0e0d M3, #2567: a text layer's own blend fill counts too; read paints through own_paints; fail the font skip when fonts are required 2026-11-29 16:22:59 +00:00
BFlat 06da46115b Merge pull request #2739 from LS254/fix/clip-covers-corner-style
M8, #2738: a chamfered or concave corner counts as cut off square for a clip that takes in the view
2026-11-29 23:15:18 +07:00
hoangquocvietuet 1dbea4b552 M3, #2567: a text run's blend fill in a shadowed pass-through frame blends with the backdrop 2026-11-29 15:56:50 +00:00
hoangquocvietuet 261d9d3847 M3, #2567: a text run's blend fill in a shadowed pass-through frame blends with the backdrop (failing test) 2026-11-29 15:56:50 +00:00
BFlat 47ac7dcf5e Merge pull request #2732 from LS254/fix/vector-stroke-align
M4, #2731: a vector's inside or outside stroke aligns only its fill's outline
2026-11-29 19:48:47 +07:00
BFlat 738a2d77e2 Merge pull request #2737 from LS254/perf/shadow-gradient
M8, #2736: a soft shadow under an opaque gradient is cast from the outline, as under an opaque colour
2026-11-29 19:30:51 +07:00
Livio Sidler a6920f0c5d M8, #2736: the gradient card's test looks for the shadow under the card, not on it
From the review of #2737: the card is black, so the darkest pixel of the view said nothing
about a shadow.
2026-11-29 12:42:23 +01:00
Livio Sidler 0aa4b2f2fc M8, #2738: a chamfered or concave corner counts as cut off square where a clip or a box is tested against a view
clip_covers and in_box tested such a corner as the arc of a round one, which cuts off
less: a clipping frame's children showed in the corner the chamfer cuts off.
2026-11-29 12:41:31 +01:00
Livio Sidler 1d18f795d0 M4, #2731: a vector's lines are placed by what is filled beside them, and trimmed only where they end on the outline
From the review of #2732:
- A segment is on the outline when the fill lies on one side of it, in the fill or outside it
  when on both or neither. The loops alone don't say: a loop inside another that turns the
  same way bounds nothing under the non-zero rule, and was stroked as outline.
- An inside stroke cut every line in the fill by the fill. Now only what shows past the
  outline around a point where such a line ends on it: a line that goes through the fill
  keeps its parts outside, and one close to the edge its whole stroke.
- A segment's middle comes from its own curve, not from a copy of the network.
- The stroke cache's key takes in the segments and the points' places: the loops name
  segments by number, and two networks can have the same path with other numbers.
2026-11-29 12:34:14 +01:00
bflatastic 1cffe6e254 render: a gradient whose handles collapse onto one line casts from its pixels
Such a gradient prepares no shader and paints nothing, so its layer is not
its outline: an outline-cast shadow would show under an invisible fill.
2026-11-29 18:30:29 +07:00
Livio Sidler ff3bcfd2a6 M8, #2736: a soft shadow under an opaque gradient is cast from the outline, as under an opaque colour 2026-11-29 12:23:05 +01:00
ls254 27aac6e002 M4, #2731: a vector's inside or outside stroke aligns only its fill's outline
A network with a line across its fill (or a tail leaving it) was stroked at twice the
weight and cut by the stroke path read as a fill: such a line came out twice as thick as
the outline or not at all. The outline is now aligned as asked for and the other segments
are stroked on their centre.
2026-11-29 12:03:30 +01:00
Jindřich Šaršon 0a6d3220bb M3: fill_with without the mask no caller passes, and without lint allows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
2026-11-29 10:45:42 +01:00
Jindřich Šaršon 071fe03776 Merge main: image averaging after #2673
#2673 draws an image shown at half its size or less from a filtered,
halved copy. The per-pixel area average from this branch now applies to
that copy below half size and to the image itself above it; the export
test of the average across fractional positions moves to 0.625 of the
image's size, where no copy is made (it still fails without the
average). Test fixtures build text through Shared<TextData> (#1819).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
2026-11-29 10:44:55 +01:00
Bryton Cooper 1157a843f8 fig: snap table cells to their grid, pill fallback connector labels, add a fidelity harness
Import tail (docs/gaps.md Gap 1), as FigCraft-side passes over the mapped
REST JSON in crates/format/src/fig/map.rs (the craft-fig mapper is pinned
and unchanged):

- A connector label without a saved snapshot gets a white, fully rounded
  stand-in pill centred under it, padded by the font size, within the layer
  budget (labels past it stay bare under the mapper's original note).
- TABLE cells are put back on the table's grid from their own geometry:
  offsets within 2 px share a track, a sizeless or misaligned cell takes its
  row and column, and no two cells overlap. Fills, strokes and text are kept.
  Rotated, non-finite, colliding or oversized tables keep their saved bounds
  with a warning. No row or column fields of the file are read.
- The new import notes are counted like the mapper's (`note (×n)`) and
  have English keys in crates/ui-egui/locales/en.toml.
- Vector-region style and variable links were already resolved with a
  fall-back to the region's own paint; no change.

Fidelity harness (Gap 3), no new dependencies:

- fig::fidelity: compare_documents (layer counts, box L-infinity error,
  text/fill/stroke/opacity match rates, warnings) and compare_rgba (SSD,
  RMSE, PSNR, luminance SSIM, channels past a tolerance), with JSON and
  Markdown scorecards.
- fidelity_tests: metric properties, a built-in corpus that round-trips
  through .fig with every layer matched and no new warnings, and an ignored
  FIGCRAFT_FIG_CORPUS runner for local real files.
- render: a multi-layer scene drawn before and after a .fig round trip is
  compared with compare_rgba (SSIM > 0.99; measured identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:53:20 -07:00
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 Cooper 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 Cooper 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 Cooper 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 Cooper 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
Jindřich Šaršon 086e709170 Merge main: export rules through world_render_bounds_with
#2616 measures each exported layer's drawn outlines through
Document::world_render_bounds_with. The export framing from this branch
(drop shadows to their blur radius, layers that draw nothing left out)
now goes through the same callback instead of a separate walk: the
callback returns None for a layer that doesn't count and takes a second
function for what a group's effects add round its children.

#2631's outline shadow path now groups blended drop shadows as the
pixel path does, so two linear-burn shadows darken where they overlap,
not the backdrop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
2026-11-27 14:23:24 +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 Sidler 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 Sidler 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