Files
wordcraft/crates/engine
VoiceLessQ 8c9b8faa59 Remove Background and the Shadow style stay bounded on big pictures (#3647)
Remove Background pushed the four neighbours of every pixel it cleared
before looking at them, so its stack grew with the picture. It now
fills a row span at a time and keeps one seed for each run of matching
pixels beside a filled span, besides the border's. A uniform 2000 x
2000 picture now peaks at the border's 8,000 seeds. The region it
clears is the same: background reachable from the border, colour kept.

The Shadow style blurred a padded copy of a plain rectangle with a
Gaussian of sigma max(w, h) / 80, a kernel that grows with the picture,
through several full-size buffers. The blur of a rectangle is the
product of its sides' blurs along each axis, so the shadow is now drawn
from two profiles, each one difference of the kernel's running sums
(the same kernel image::imageops::blur uses). A test compares it with
the old blur: no channel differs by more than 2.

Measured on a uniform picture, dev profile, wall time and peak RSS of
the test process:
- Shadow, 4000 x 4000: 15.4 s and 414 MB before, 0.31 s and 203 MB now
- Remove Background, 6000 x 6000: 1.02 s and 1,028 MB before,
  0.54 s and 325 MB now (the picture and its RGBA copy alone: 289 MB)

The input is already held to the decode budget (#3644).
2026-10-24 18:01:45 -01:00
..