Key the paint list park sites so a group-free paint moves

This commit is contained in:
Dennis Kobert
2026-09-05 12:10:20 +00:00
parent 14660bdb64
commit 38d479bdfa
4 changed files with 10 additions and 8 deletions

View File

@@ -1835,7 +1835,7 @@ mod run_tests {
}; };
// SAFETY: the list serves only while `persistent` is live, and the // SAFETY: the list serves only while `persistent` is live, and the
// promote under test replaces every borrow it carries. // promote under test replaces every borrow it carries.
let (paint, _) = transient.alloc(unsafe { core_types::record::erase_static(published) }).unwrap(); let (paint, _) = transient.alloc_sized_keyed(unsafe { core_types::record::erase_static(published) }, 0).unwrap();
let occupied = persistent.occupancy(); let occupied = persistent.occupancy();
let (layout, span, _frames) = promote_paint_field(Some(paint), 1, &transient, &persistent); let (layout, span, _frames) = promote_paint_field(Some(paint), 1, &transient, &persistent);
@@ -1859,7 +1859,7 @@ mod run_tests {
let Some(Graphic::Vector(vector)) = paint.element(0) else { panic!("the paint carries a vector") }; let Some(Graphic::Vector(vector)) = paint.element(0) else { panic!("the paint carries a vector") };
vector.point_domain.positions().as_ptr() vector.point_domain.positions().as_ptr()
}; };
let (paint, _) = transient.alloc(paint).unwrap(); let (paint, _) = transient.alloc_sized_keyed(paint, 0).unwrap();
let (layout, span, _frames) = promote_paint_field(Some(paint), 2, &transient, &persistent); let (layout, span, _frames) = promote_paint_field(Some(paint), 2, &transient, &persistent);
let served = promoted_paint(&span, &layout, 0, &persistent); let served = promoted_paint(&span, &layout, 0, &persistent);

View File

@@ -214,7 +214,7 @@ where
}; };
let park_paint = |paint: Option<List<Graphic<'static>>>| -> Result<Option<&'e List<Graphic<'static>>>, Interrupt> { let park_paint = |paint: Option<List<Graphic<'static>>>| -> Result<Option<&'e List<Graphic<'static>>>, Interrupt> {
match paint { match paint {
Some(paint) => Ok(Some(arena.alloc(paint).ok_or_else(exhausted)?.0)), Some(paint) => Ok(Some(arena.alloc_sized_keyed(paint, 0).ok_or_else(exhausted)?.0)),
None => Ok(None), None => Ok(None),
} }
}; };

View File

@@ -69,7 +69,7 @@ fn boolean_core<'e>(
}; };
let park_paint = |paint: Option<List<Graphic<'static>>>| -> Result<Option<&'e List<Graphic>>, core_types::gpoll::Interrupt> { let park_paint = |paint: Option<List<Graphic<'static>>>| -> Result<Option<&'e List<Graphic>>, core_types::gpoll::Interrupt> {
match paint { match paint {
Some(list) => Ok(Some(arena.alloc(list).ok_or_else(exhausted)?.0)), Some(list) => Ok(Some(arena.alloc_sized_keyed(list, 0).ok_or_else(exhausted)?.0)),
None => Ok(None), None => Ok(None),
} }
}; };
@@ -82,7 +82,7 @@ fn boolean_core<'e>(
let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0; let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0;
// Snapshot the input layers so the renderer can recurse into them for // Snapshot the input layers so the renderer can recurse into them for
// editor click-target preservation. // editor click-target preservation.
let merged_layers = arena.alloc(snapshot).ok_or_else(exhausted)?.0; let merged_layers = arena.alloc_sized_keyed(snapshot, 0).ok_or_else(exhausted)?.0;
Ok(( Ok((
element, element,

View File

@@ -276,8 +276,10 @@ fn assign_colors_graphic_extent(
pub use _assign_colors_graphic_mod::assign_colors_graphic_entries; pub use _assign_colors_graphic_mod::assign_colors_graphic_entries;
/// Keyed, so a group-free paint's promote moves this header rather than
/// cloning the content it owns.
fn park_paint<'e>(arena: &'e core_types::arena::Arena, paint: List<Graphic<'static>>) -> Result<&'e List<Graphic<'static>>, Interrupt> { fn park_paint<'e>(arena: &'e core_types::arena::Arena, paint: List<Graphic<'static>>) -> Result<&'e List<Graphic<'static>>, Interrupt> {
let (parked, _) = arena.alloc(paint).ok_or(GraphError { let (parked, _) = arena.alloc_sized_keyed(paint, 0).ok_or(GraphError {
kind: core_types::gpoll::ErrorKind::ArenaExhausted, kind: core_types::gpoll::ErrorKind::ArenaExhausted,
trace: Vec::new(), trace: Vec::new(),
})?; })?;
@@ -1555,7 +1557,7 @@ fn emit_legacy_lane<'e>(
let merged_layers = output let merged_layers = output
.attribute::<Option<List<Graphic>>>(ATTR_EDITOR_MERGED_LAYERS, lane) .attribute::<Option<List<Graphic>>>(ATTR_EDITOR_MERGED_LAYERS, lane)
.and_then(|layers| layers.as_ref()) .and_then(|layers| layers.as_ref())
.map(|layers| arena.alloc(layers.clone()).ok_or_else(exhausted).map(|(parked, _)| parked)) .map(|layers| arena.alloc_sized_keyed(layers.clone(), 0).ok_or_else(exhausted).map(|(parked, _)| parked))
.transpose()?; .transpose()?;
Ok(( Ok((
@@ -1884,7 +1886,7 @@ fn flatten_path_core<'e>(
let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0; let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0;
// Snapshot the input layers so the renderer can recurse into them for // Snapshot the input layers so the renderer can recurse into them for
// editor click-target preservation, as the boolean operation does. // editor click-target preservation, as the boolean operation does.
let merged_layers = arena.alloc(snapshot).ok_or_else(exhausted)?.0; let merged_layers = arena.alloc_sized_keyed(snapshot, 0).ok_or_else(exhausted)?.0;
Ok((output, Attr(DAffine2::IDENTITY), Attr(fill), Attr(stroke), Attr(layer_path.as_slice()), Attr(Some(merged_layers)))) Ok((output, Attr(DAffine2::IDENTITY), Attr(fill), Attr(stroke), Attr(layer_path.as_slice()), Attr(Some(merged_layers))))
} }