Clip quad damage with layer bounds in iced_tiny_skia
This commit is contained in:
parent
1e8554bf02
commit
43aafb7b79
1 changed files with 11 additions and 1 deletions
|
|
@ -174,10 +174,20 @@ impl Layer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn damage(previous: &Self, current: &Self) -> Vec<Rectangle> {
|
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(
|
let mut damage = damage::list(
|
||||||
&previous.quads,
|
&previous.quads,
|
||||||
¤t.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, background_a), (quad_b, background_b)| {
|
||||||
quad_a == quad_b && background_a == background_b
|
quad_a == quad_b && background_a == background_b
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue