Skip to content

Commit

Permalink
feat: Hyper minor rendering optimization (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 authored Nov 11, 2023
1 parent 1afdce9 commit 6d41744
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crates/common/src/event_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub enum EventMessage {
RequestRelayout,
/// Request a rerender
RequestRerender,
/// Request a redraw
RequestRedraw,
/// Remeasure a text elements group
RemeasureTextGroup(Uuid),
/// Change the cursor icon
Expand Down
4 changes: 1 addition & 3 deletions crates/renderer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ impl<State: 'static + Clone> App<State> {
if must_relayout {
self.window_env.window.request_redraw();
} else if must_repaint {
self.proxy
.send_event(EventMessage::RequestRerender)
.unwrap();
self.proxy.send_event(EventMessage::RequestRedraw).unwrap();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/renderer/src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub fn run_event_loop<State: Clone>(
Event::UserEvent(EventMessage::RequestRerender) => {
app.window_env().window().request_redraw();
}
Event::UserEvent(EventMessage::RequestRedraw) => app.render(&hovered_node),
Event::UserEvent(EventMessage::RequestRelayout) => {
app.process_layout();
}
Expand Down

0 comments on commit 6d41744

Please sign in to comment.