Skip to content

Commit

Permalink
fix: Small fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Aug 15, 2024
1 parent 9ecd61e commit 16f3387
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions crates/common/src/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl Compositor {
if self.full_render {
dirty_nodes.clear();
dirty_area.take();
self.full_render = false;
return layers;
}

Expand Down Expand Up @@ -165,8 +166,6 @@ impl Compositor {
run_check(*layer, nodes);
}

self.full_render = false;

rendering_layers
}

Expand Down
9 changes: 6 additions & 3 deletions crates/core/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn process_render(
let mut compositor_dirty_nodes = fdom.compositor_dirty_nodes();
let mut rendering_layers = Layers::default();

let dirty_layers = compositor.run(
let rendering_layers = compositor.run(
&mut compositor_dirty_nodes,
&mut compositor_dirty_area,
|node, try_traverse_children| {
Expand Down Expand Up @@ -74,6 +74,8 @@ pub fn process_render(
dirty_canvas.save();
let compositor_dirty_area: &Option<Area> = &compositor_dirty_area;
if let Some(dirty_area) = compositor_dirty_area {
// Clear using the configured window background only the dirty
// area in which it will render the intersected nodes again
dirty_canvas.clip_rect(
Rect::new(
dirty_area.min_x(),
Expand All @@ -89,8 +91,8 @@ pub fn process_render(

let mut painted = Vec::new();

// Render the dirty nodes
for (_, nodes) in sorted(dirty_layers.iter()) {
// Render the layers
for nodes in sorted(rendering_layers.values()) {
'elements: for node_id in nodes {
let node = rdom.get(*node_id).unwrap();
let node_viewports = node.get::<ViewportState>().unwrap();
Expand All @@ -105,6 +107,7 @@ pub fn process_render(
continue 'elements;
}
}

// Render the element
render_fn(fdom, node_id, layout_node, &layout, dirty_canvas);
painted.push(node_id);
Expand Down

0 comments on commit 16f3387

Please sign in to comment.