mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
A node with live geometry effects (Offset Path, Outline Stroke, Warp, Transform, Roughen…) had them computed again on every frame: Offset Path's curve offsetting and boolean sweep for every object, every time the canvas redrew. Rendering 2,000 paths that each have Offset Path, warm: 175 → 11.8 ms. The renderer keeps each node's effected geometry, and each appearance item's own geometry effects on it, keyed by the node's Arc identity like its other per-node caches. The entry keeps the Arc alive, so a hit is exact and an edited object (a new node) gets new geometry. Only the node draw_arc is drawing uses the cache: its path comes from the node alone, so its effects give the same result every frame. Entries not drawn for three frames are swept like the rest. cached_effect_geometry_draws_the_same_pixels renders a page of Offset Path, Roughen + Drop Shadow, Warp + Outline Stroke and Transform objects (with item-level Offset Path) cold, warm, after a pan and with a fresh renderer, and gets the same pixels each time; after an edit, the warm renderer draws what a fresh one does. Keying the cache by node id instead of identity fails it. The render suite (216 tests, golden images included) passes unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmMmc1J8XeNLxhRihWv9cc