diff options
author | 2024-04-10 20:31:44 +0200 | |
---|---|---|
committer | 2024-04-10 20:31:44 +0200 | |
commit | 43aafb7b79d51106c05f2494e6adc4a7a51d947e (patch) | |
tree | dce72225dcb69b27d9384eb83b2d328d67227500 /tiny_skia | |
parent | 1e8554bf02f366b18b31b9ea1dfb150f7935ca06 (diff) | |
download | iced-43aafb7b79d51106c05f2494e6adc4a7a51d947e.tar.gz iced-43aafb7b79d51106c05f2494e6adc4a7a51d947e.tar.bz2 iced-43aafb7b79d51106c05f2494e6adc4a7a51d947e.zip |
Clip quad damage with layer bounds in `iced_tiny_skia`
Diffstat (limited to 'tiny_skia')
-rw-r--r-- | tiny_skia/src/layer.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index ec87c2bf..3e42e4aa 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -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, ¤t.quads, - |(quad, _)| vec![quad.bounds.expand(1.0)], + |(quad, _)| { + quad.bounds + .expand(1.0) + .intersection(¤t.bounds) + .into_iter() + .collect() + }, |(quad_a, background_a), (quad_b, background_b)| { quad_a == quad_b && background_a == background_b }, |