mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
Each pointer move of a drag applies the move to the interaction's snapshot, so the dragged object is a new node in every frame. The renderer kept the rasters of an object's drop shadows, outer glows and filtered content (Gaussian Blur, Feather and the Photoshop-style filters) only for the same node, so every frame of a drag ran those effects again. On main, a moved frame of texture_drag_perf (a CMYK rounded rectangle at 190.07% and DPI 1.5 in an 1800 x 1500 view) took 112 to 197 ms in a release build. The canvas now renders with RenderOptions::interacting while a drag or a dialog's preview is in progress. When an object misses its cached raster in such a frame, the renderer takes the raster an earlier frame made for an object with the same id, slot and ink at the same zoom and rotation, made by the same effects from content of the same size (to within 0.000001 pt). It draws the object's content into a raster placed as that one was and compares the pixels byte for byte (only the alpha under a shadow or glow). For Feather it also compares the points of the clip outline, to within 0.000001 pt. When they match, the old raster is drawn at the new place, rounded to a whole pixel, as a pan draws a cached raster. Content under De-Interlace never takes a moved raster, and a raster made over moved rasters counts as moved itself. A frame rendered without interacting never draws such a raster, or a raster made over one: the frame after the drag runs the effects again and draws what a fresh renderer draws. The canvas's cache key includes whether an interaction is in progress. On the desktop, the canvas sends the frame after an interaction to the render worker when the frame shown drew moved rasters. Each cached raster keeps the content it was made from, within the existing 512 MiB budget. The pixels kept with a filtered raster take as many bytes as the raster, and the alpha kept with a shadow or glow takes a quarter as many as the shadow. texture_drag_perf now renders a drag's frames as the canvas does, then the frame after the drag, and that frame once more with every raster cached. A moved frame now takes 20 to 26 ms, close to the 18 to 25 ms of the cached frame; the frame after the drag takes 110 to 189 ms. Docs: docs/target-app-parity.md.