Expand damage regions of Clip primitives a bit
This commit is contained in:
parent
200a29c069
commit
38f82ab35f
2 changed files with 5 additions and 3 deletions
|
|
@ -17,19 +17,21 @@ pub fn regions(a: &Primitive, b: &Primitive) -> Vec<Rectangle> {
|
||||||
Primitive::Clip {
|
Primitive::Clip {
|
||||||
bounds: bounds_a,
|
bounds: bounds_a,
|
||||||
content: content_a,
|
content: content_a,
|
||||||
|
..
|
||||||
},
|
},
|
||||||
Primitive::Clip {
|
Primitive::Clip {
|
||||||
bounds: bounds_b,
|
bounds: bounds_b,
|
||||||
content: content_b,
|
content: content_b,
|
||||||
|
..
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
if bounds_a == bounds_b {
|
if bounds_a == bounds_b {
|
||||||
return regions(content_a, content_b)
|
return regions(content_a, content_b)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|r| r.intersection(bounds_a))
|
.filter_map(|r| r.intersection(&bounds_a.expand(1.0)))
|
||||||
.collect();
|
.collect();
|
||||||
} else {
|
} else {
|
||||||
return vec![*bounds_a, *bounds_b];
|
return vec![bounds_a.expand(1.0), bounds_b.expand(1.0)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ impl Primitive {
|
||||||
Self::Quad { bounds, .. }
|
Self::Quad { bounds, .. }
|
||||||
| Self::Image { bounds, .. }
|
| Self::Image { bounds, .. }
|
||||||
| Self::Svg { bounds, .. } => bounds.expand(1.0),
|
| Self::Svg { bounds, .. } => bounds.expand(1.0),
|
||||||
Self::Clip { bounds, .. } => *bounds,
|
Self::Clip { bounds, .. } => bounds.expand(1.0),
|
||||||
Self::SolidMesh { size, .. } | Self::GradientMesh { size, .. } => {
|
Self::SolidMesh { size, .. } | Self::GradientMesh { size, .. } => {
|
||||||
Rectangle::with_size(*size)
|
Rectangle::with_size(*size)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue