Merge pull request #2829 from EleDiaz/tiny-skia-fix

Fix error on chromium like browsers when canvas initial size is (0,0)
This commit is contained in:
Héctor 2025-11-21 02:35:56 +01:00 committed by GitHub
commit 75e83a77ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,14 +68,15 @@ impl crate::graphics::Compositor for Compositor {
let mut surface = Surface { let mut surface = Surface {
window, window,
clip_mask: tiny_skia::Mask::new(width, height) clip_mask: tiny_skia::Mask::new(1, 1).expect("Create clip mask"),
.expect("Create clip mask"),
layer_stack: VecDeque::new(), layer_stack: VecDeque::new(),
background_color: Color::BLACK, background_color: Color::BLACK,
max_age: 0, max_age: 0,
}; };
self.configure_surface(&mut surface, width, height); if width > 0 && height > 0 {
self.configure_surface(&mut surface, width, height);
}
surface surface
} }