Canvas redraw: each version's trace source read from its own node; the 3D-bounds map's bound documented

Diff took the Image Trace flag of the old version for both sides when it
read each version's first member. Both versions have the same extras
there (same_but_members), so the result was right, but each side now
reads its own node.

The doc of Renderer's three_d_bounds now says what adds an entry, when
entries are swept, and the bound that follows: about twice the live 3D
art plus 1024 entries.
This commit is contained in:
Drew Dibble
2026-11-09 09:48:50 -07:00
parent d8472b2acc
commit 0f75f8e9da
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -183,8 +183,8 @@ impl Diff<'_, '_> {
{
// An Image Trace object draws its hidden source image, its first member, in some views.
// Each version's own: an edit can put another member first (undoing Send to Back).
let first = |m: &[Arc<Node>]| old.extras().trace.is_some().then(|| m.first().map(|s| s.id)).flatten();
let outer = std::mem::replace(&mut self.sources, (first(a), first(b)));
let first = |n: &Node, m: &[Arc<Node>]| n.extras().trace.is_some().then(|| m.first().map(|s| s.id)).flatten();
let outer = std::mem::replace(&mut self.sources, (first(old, a), first(new, b)));
self.children(a, b);
self.sources = outer;
} else if let Some((area, moved, anchors)) = moved_anchors(old, new) {
+5 -1
View File
@@ -175,7 +175,11 @@ pub struct Renderer {
/// let go when a frame ends.
pub(crate) pass_bounds: PtrMap<usize, (Arc<Node>, Option<Rect>)>,
/// The 3D effects' art among the art `fx_art` made, by its address, with the art (weakly: what
/// keeps the art is `fx_arts` and `measured`) and its bounds once measured.
/// keeps the art is `fx_arts` and `measured`) and its bounds once measured. An entry is added
/// for every 3D art made, measured or not, and entries whose art is gone are swept when the map
/// reaches twice the size it kept at the last sweep (at least 1024), so it holds at most about
/// twice the live 3D art plus 1024 entries. Until swept, an entry's weak pointer keeps the art's
/// allocation (not its contents) alive.
three_d_bounds: PtrMap<usize, ThreeDArt>,
/// How many entries `three_d_bounds` kept when it last let go of the art no longer held: it
/// does so again when it holds twice as many.