mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
While the renderer drew a brushed path on its fast path, it drew the pieces of brush art with that path still set as the object being drawn. cached_stroke and fill_path_gradient then kept the outlines and gradient slices of the pieces' strokes under the brushed path and the address of each piece's stroke. The entries held the brushed path and not the pieces, so a piece made later could take the address of an earlier piece's stroke and be drawn with that piece's outline. The instances of a symbol and the copies of a live repeat replace each other's brush art, so it is made again for each of them in every frame, and every brushed path gets new brush art when the document's brushes change. In a test, a renderer drawing three instances of a symbol whose art holds a path brushed with a scatter brush of a stroked square drew frames that differed from a new renderer's in 316 to 1,140 pixels. The two caches now keep only the strokes of the object being drawn. With vectorcraft-cli bench at 2880x1800 on 8 threads, 2,000 instances of a symbol of eight brushed paths took 203.4 ms a frame on main and 155.9 ms with this change. 2,000 groups of the same paths, for which main keeps the brush art and the outlines of its strokes between frames, took 133.7 ms on main and 156.9 ms with this change. The peak working set of a bench run at 2880x1800 went from 609 MiB to 127 MiB on the instances and from 331 MiB to 210 MiB on the groups.