From b6085cd8034c340216633c99f12498c9097071b7 Mon Sep 17 00:00:00 2001 From: Seldom <38388947+Seldom-SE@users.noreply.github.com> Date: Fri, 31 May 2024 16:47:42 -0700 Subject: [PATCH] More efficient resizing --- src/screen.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/screen.rs b/src/screen.rs index 446ca1f..0bdfdba 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -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;