Skip to content

Commit

Permalink
[awm2] Always push extra draws to video memory
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Nov 27, 2022
1 parent 0a9eb8a commit 714303d
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions rust_programs/awm2/src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,23 +555,20 @@ impl Desktop {
// Now blit the screen buffer to the backing video memory
// Follow the same steps as above to only copy what's changed
// And empty queues as we go
//
let buffer = &mut *self.screen_buffer_layer.get_slice(self.desktop_frame);
let vmem = &mut *self.video_memory_layer.get_slice(self.desktop_frame);

// We don't need to walk each individual view - we can rely on the logic above to have drawn it to the screen buffer
self.compositor_state.extra_draws.borrow_mut().drain(..);
//self.compositor_state.extra_draws.borrow_mut().drain(..);
for (_, extra_draw) in self.compositor_state.extra_draws.borrow_mut().drain(..) {
Self::copy_rect(buffer, vmem, extra_draw);
}

for full_redraw_rect in self.compositor_state.rects_to_fully_redraw.drain(..) {
Self::copy_rect(
&mut *self.screen_buffer_layer.get_slice(self.desktop_frame),
&mut *self.video_memory_layer.get_slice(self.desktop_frame),
full_redraw_rect,
);
Self::copy_rect(buffer, vmem, full_redraw_rect);
}

Self::copy_rect(
&mut *self.screen_buffer_layer.get_slice(self.desktop_frame),
&mut *self.video_memory_layer.get_slice(self.desktop_frame),
mouse_rect,
);
Self::copy_rect(buffer, vmem, mouse_rect);
}

fn copy_rect(src: &mut dyn LikeLayerSlice, dst: &mut dyn LikeLayerSlice, rect: Rect) {
Expand Down

0 comments on commit 714303d

Please sign in to comment.