Files
vectorcraft/crates/brush
Muhammad Saad 674a485145 Brushes: one output budget across tracks, tiles and copies (#3594)
Pattern tiling and scatter cap each factor on its own: 20,000 tiles a
run, MAX_SUB subdivisions a segment, 20,000 copies a track. Those caps
are per track, and a path has as many tracks as it has subpaths, so
they multiply rather than bound.

The audit called the end-to-end impact unverified, so it was measured.
A pattern brush on parallel lines, each long enough to want more tiles
than a run allows:

   1 subpath    20,000 nodes     320,000 anchors    36 ms
   4 subpaths   80,000 nodes   1,280,000 anchors   142 ms
  16 subpaths  320,000 nodes   5,120,000 anchors   571 ms

Exactly 20,000 nodes a subpath, linear with no ceiling. Scatter is the
same shape.

MAX_ANCHORS bounds the total for one brushed stroke, threaded through
both. It is 2,000,000, the figure the stacked-effects budget already
uses (effects::distort::MAX_COPY_ANCHORS, #3578), and bounded the same
way: per stroke rather than per document. One track at its own cap is
well inside it, so the budget bites only where the caps were
multiplying; sixteen subpaths now stop at the budget in 113 ms.

A piece is taken whole or not at all, so art is never half-drawn. The
walk that counts an art tile's anchors is iterative, and a tree it
cannot finish within MAX_WALK nodes is charged the whole budget rather
than undercounted, so nesting buys no room.

The per-factor caps are untouched: the issue asks for a total, and
changing both at once would hide which one did the bounding.
2026-10-23 06:56:56 +07:00
..