Skip to content

Commit

Permalink
Add comments and improve performance of a comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedlund committed Dec 15, 2013
1 parent a9af374 commit 1aed7a3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/main/compositing/run.rs
Expand Up @@ -50,9 +50,11 @@ pub fn run_compositor(compositor: &CompositorTask) {
let mut window_size = Size2D(window_size.width as uint, window_size.height as uint);
let mut done = false;
let mut recomposite = false;
let mut composite_ready = false;
let graphics_context = CompositorTask::create_graphics_context();

// Tracks whether the renderer is idle and it's now safe to perform a composite
let mut composite_ready = false;

// Keeps track of the current zoom factor
let mut world_zoom = 1f32;
let mut zoom_action = false;
Expand Down Expand Up @@ -86,10 +88,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
ChangeReadyState(ready_state) => window.set_ready_state(ready_state),
ChangeRenderState(render_state) => {
window.set_render_state(render_state);
composite_ready = match render_state {
IdleRenderState => true,
_ => false,
}
composite_ready = render_state == IdleRenderState;
}

SetUnRenderedColor(_id, color) => {
Expand Down Expand Up @@ -412,6 +411,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
// Check for messages coming from the windowing system.
check_for_window_messages(window.recv());

// If asked to recomposite and renderer is in a safe/idle state
if recomposite && composite_ready {
recomposite = false;
composite();
Expand Down

0 comments on commit 1aed7a3

Please sign in to comment.