Removed all_ancestors traversals

This commit is contained in:
alonso.torres
2025-10-21 09:47:08 +02:00
parent e58b2453b1
commit e4b4f1bd08
2 changed files with 0 additions and 58 deletions

View File

@@ -1792,23 +1792,6 @@ impl RenderState {
}
}
/// Processes all ancestors of a shape, invalidating their extended rectangles and updating their tiles
///
/// When a shape changes, all its ancestors need to have their extended rectangles recalculated
/// because they may contain the changed shape. This function:
/// 1. Computes all ancestors of the shape
/// 2. Invalidates the extrect cache for each ancestor
/// 3. Updates the tiles for each ancestor to ensure proper rendering
pub fn process_shape_ancestors(
&mut self,
shape: &Shape,
tree: &mut ShapesPool,
modifiers: &HashMap<Uuid, Matrix>,
) {
let ancestors = shape.all_ancestors(tree, false);
self.invalidate_and_update_tiles(&ancestors, tree, modifiers);
}
/// Rebuilds tiles for shapes with modifiers and processes their ancestors
///
/// This function applies transformation modifiers to shapes and updates their tiles.

View File

@@ -959,47 +959,6 @@ impl Shape {
}
}
/// Returns all ancestor shapes of this shape, traversing up the parent hierarchy
///
/// This function walks up the parent chain starting from this shape's parent,
/// collecting all ancestor IDs. It stops when it reaches a nil UUID or when
/// an ancestor is hidden (unless include_hidden is true).
///
/// # Arguments
/// * `shapes` - The shapes pool containing all shapes
/// * `include_hidden` - Whether to include hidden ancestors in the result
///
/// # Returns
/// A set of ancestor UUIDs in traversal order (closest ancestor first)
pub fn all_ancestors(&self, shapes: &ShapesPool, include_hidden: bool) -> IndexSet<Uuid> {
let mut ancestors = IndexSet::new();
let mut current_id = self.id;
// Traverse upwards using parent_id
while let Some(parent_id) = shapes.get(&current_id).and_then(|s| s.parent_id) {
// If the parent_id is the zero UUID, there are no more ancestors
if parent_id == Uuid::nil() {
break;
}
// Check if the ancestor is hidden
if let Some(parent) = shapes.get(&parent_id) {
if !include_hidden && parent.hidden() {
break;
}
ancestors.insert(parent_id);
current_id = parent_id;
} else {
// FIXME: This should panic! I've removed it temporarily until
// we fix the problems with shapes without parents.
// panic!("Parent can't be found");
break;
}
}
ancestors
}
pub fn get_matrix(&self) -> Matrix {
let mut matrix = Matrix::new_identity();
matrix.post_translate(self.left_top());