mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 15:36:11 +02:00
Merge pull request #6121 from penpot/superalex-tada-improve-tile-shapes-iteration-2
🎉 Improve tile shapes iteration
This commit is contained in:
commit
4c12af957c
2 changed files with 21 additions and 19 deletions
|
@ -688,7 +688,6 @@ impl RenderState {
|
|||
});
|
||||
|
||||
if element.is_recursive() {
|
||||
// Fix this
|
||||
let children_clip_bounds = node_render_state
|
||||
.get_children_clip_bounds(element, modifiers.get(&element.id));
|
||||
for child_id in element.children_ids().iter().rev() {
|
||||
|
@ -732,17 +731,22 @@ impl RenderState {
|
|||
if let Some(next_tile) = self.pending_tiles.pop() {
|
||||
self.update_render_context(next_tile);
|
||||
if !self.surfaces.has_cached_tile_surface(next_tile) {
|
||||
// If the tile is empty or it doesn't exists we don't do anything with it
|
||||
if self.tiles.has_shapes_at(next_tile) {
|
||||
// TODO: This should be more efficient, we should be able to know exactly what shapes tree
|
||||
// are included for this tile
|
||||
self.pending_nodes.push(NodeRenderState {
|
||||
id: Uuid::nil(),
|
||||
visited_children: false,
|
||||
clip_bounds: None,
|
||||
visited_mask: false,
|
||||
mask: false,
|
||||
});
|
||||
if let Some(ids) = self.tiles.get_shapes_at(next_tile) {
|
||||
for id in ids {
|
||||
let element = tree.get_mut(&id).ok_or(
|
||||
"Error: Element with root_id {id} not found in the tree."
|
||||
.to_string(),
|
||||
)?;
|
||||
if element.parent_id == Some(Uuid::nil()) {
|
||||
self.pending_nodes.push(NodeRenderState {
|
||||
id: *id,
|
||||
visited_children: false,
|
||||
clip_bounds: None,
|
||||
visited_mask: false,
|
||||
mask: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -792,10 +796,12 @@ impl RenderState {
|
|||
while let Some(shape_id) = nodes.pop() {
|
||||
if let Some(shape) = tree.get(&shape_id) {
|
||||
let mut shape = shape.clone();
|
||||
if let Some(modifier) = modifiers.get(&shape_id) {
|
||||
shape.apply_transform(modifier);
|
||||
if shape_id != Uuid::nil() {
|
||||
if let Some(modifier) = modifiers.get(&shape_id) {
|
||||
shape.apply_transform(modifier);
|
||||
}
|
||||
self.update_tile_for(&shape);
|
||||
}
|
||||
self.update_tile_for(&shape);
|
||||
for child_id in shape.children_ids().iter() {
|
||||
nodes.push(*child_id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue