diff options
Diffstat (limited to '')
| -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              }, | 
