Files
photocraft/crates/engine/examples
artman67andClaude Opus 5.5 2d74ffb004 perf(paint): big imported brushes draw about twice as fast while painting
A large sampled-tip brush (an imported .abr with a Dual Brush, at 800 px on a 4K
canvas) spent most of each live frame on pixels that could never be painted:

- A sampled dab was rasterised over the square that fits the tip at any angle.
  It now uses the rotated tip's own box, and in each row only the run of pixels
  whose tip coordinates can land on the tip (solved from the affine pixel-to-tip
  map, with slack; every pixel in the run still takes the exact test).
- The live preview composited the smoothing tail's tiles twice and restored the
  previous tail over tiles that get rewritten anyway. `composite_live` does each
  tile once.
- The composite looked up the Dual Brush tile per pixel; it now does it per tile.
- Tip, texture and pattern sampling use a truncating floor (the baseline x86-64
  build makes `f32::floor` a libm call) and an interior fast path without edge
  checks, with the same arithmetic.

Pixels are unchanged: new tests compare the tight box and row runs with a full
scan at many angles, flips, roundness and projection, and the live preview with
the finished stroke after every chunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:40:35 -04:00
..
2026-09-30 09:37:18 -04:00