Fix panic rendering an out of bounds clip in iced_tiny_skia

This commit is contained in:
Héctor Ramón Jiménez 2023-03-17 19:35:57 +01:00
parent caf2836b1b
commit c8f637fc16
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -267,6 +267,14 @@ impl Backend {
Primitive::Clip { bounds, content } => {
let bounds = (*bounds + translation) * scale_factor;
if bounds.x + bounds.width <= 0.0
|| bounds.y + bounds.height <= 0.0
|| bounds.x as u32 >= pixels.width()
|| bounds.y as u32 >= pixels.height()
{
return;
}
adjust_clip_mask(clip_mask, pixels, bounds);
self.draw_primitive(