Resize Surface::buffer instead of reallocating in iced_tiny_skia

This commit is contained in:
Héctor Ramón Jiménez 2023-02-25 21:06:58 +01:00
parent 535d7a4d57
commit 445b31c6c5
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -58,7 +58,8 @@ impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
) {
surface.pixels = tiny_skia::Pixmap::new(width, height)
.expect("Create pixmap for window");
surface.buffer = vec![0; (width * height) as usize];
surface.buffer.resize((width * height) as usize, 0);
}
fn fetch_information(&self) -> Information {