mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 09:20:56 -06:00
Render: the frame after anchors of a long path move updates only the segments that touch them
The renderer keeps the path of a path or compound path of 1,024 anchors or more by object id, with the bounds of its segments and of its miter spikes in runs of 128 segments. When anchors move and the subpaths and anchor counts stay the same, the next frame rewrites only the path elements of the segments that start or end at a moved anchor, and measures again only the runs that hold them and the runs of the segments with length before them. Other edits make the path again as before. The pixels and the cull bounds are the same. - StrokeLayer::bounds_on is unchanged. The miter tip of one joint (miter_tip) and the stroke box with given tips (bounds_with_tips) are new functions beside it, and Appearance::stroked_bounds_by takes the box of each shaped stroke, so the cull bounds of a kept path use the kept tips. - geom::bez::has_length is the predicate reach.rs used for segments that draw, made public. Docs: docs/target-app-parity.md.
This commit is contained in:
@@ -34,6 +34,7 @@ impl Renderer {
|
||||
clips: FrameCache::new(lru::CLIP_BUDGET, 256),
|
||||
threads: default_threads(),
|
||||
geom: PtrMap::default(),
|
||||
kept: PtrMap::default(),
|
||||
symbols: vec![],
|
||||
plugin_revision: 0,
|
||||
strokes: PtrMap::default(),
|
||||
@@ -180,6 +181,9 @@ impl Renderer {
|
||||
// them, a drag left up to that many old copies of the object alive, each with all its
|
||||
// members (and, for a compound path, its assembled path).
|
||||
self.geom.retain(|_, e| g - e.stamp <= 3);
|
||||
// A kept path stays while its object is in `geom`, which keeps the objects still drawn.
|
||||
let geom = &self.geom;
|
||||
self.kept.retain(|_, e| g - e.stamp <= 3 || geom.get(&(Arc::as_ptr(&e.node) as usize)).is_some_and(|k| Arc::ptr_eq(&k.node, &e.node)));
|
||||
if self.strokes.len() > 1024 {
|
||||
self.strokes.retain(|_, e| g - e.stamp <= 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user