Skip to content

Commit

Permalink
More efficient resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldom-SE committed May 31, 2024
1 parent 95d739b commit b6085cd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,11 @@ fn resize_screen(
let computed_size = screen.size.compute(window_size);

if computed_size != screen.computed_size {
let image = images.get_mut(&screen.image).unwrap();
image.data = vec![0; (computed_size.x * computed_size.y) as usize];

let size = &mut image.texture_descriptor.size;
size.width = computed_size.x;
size.height = computed_size.y;
images.get_mut(&screen.image).unwrap().resize(Extent3d {
width: computed_size.x,
height: computed_size.y,
..default()
});
}

screen.computed_size = computed_size;
Expand Down

0 comments on commit b6085cd

Please sign in to comment.