Clip quad damage with layer bounds in iced_tiny_skia

This commit is contained in:
Héctor Ramón Jiménez 2024-04-10 20:31:44 +02:00
parent 1e8554bf02
commit 43aafb7b79
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -174,10 +174,20 @@ impl Layer {
}
pub fn damage(previous: &Self, current: &Self) -> Vec<Rectangle> {
if previous.bounds != current.bounds {
return vec![previous.bounds, current.bounds];
}
let mut damage = damage::list(
&previous.quads,
&current.quads,
|(quad, _)| vec![quad.bounds.expand(1.0)],
|(quad, _)| {
quad.bounds
.expand(1.0)
.intersection(&current.bounds)
.into_iter()
.collect()
},
|(quad_a, background_a), (quad_b, background_b)| {
quad_a == quad_b && background_a == background_b
},