desktop: Fixup intersection calls

This commit is contained in:
Victor Brekenfeld 2021-12-20 19:12:21 +01:00
parent a948ff8829
commit 827a3c8c2a
2 changed files with 4 additions and 8 deletions

View File

@ -165,8 +165,7 @@ where
let new_damage = damage let new_damage = damage
.iter() .iter()
.cloned() .cloned()
.filter(|geo| geo.overlaps(rect)) .flat_map(|geo| geo.intersection(rect))
.map(|geo| geo.intersection(rect))
.map(|mut geo| { .map(|mut geo| {
geo.loc -= rect.loc; geo.loc -= rect.loc;
geo geo

View File

@ -570,8 +570,7 @@ impl Space {
if damage.iter().any(|geo| lgeo.overlaps(*geo)) { if damage.iter().any(|geo| lgeo.overlaps(*geo)) {
let layer_damage = damage let layer_damage = damage
.iter() .iter()
.filter(|geo| geo.overlaps(lgeo)) .flat_map(|geo| geo.intersection(lgeo))
.map(|geo| geo.intersection(lgeo))
.map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
slog::trace!( slog::trace!(
@ -600,8 +599,7 @@ impl Space {
loc -= output_geo.loc; loc -= output_geo.loc;
let win_damage = damage let win_damage = damage
.iter() .iter()
.filter(|geo| geo.overlaps(wgeo)) .flat_map(|geo| geo.intersection(wgeo))
.map(|geo| geo.intersection(wgeo))
.map(|geo| Rectangle::from_loc_and_size(geo.loc - loc, geo.size)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - loc, geo.size))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
slog::trace!( slog::trace!(
@ -631,8 +629,7 @@ impl Space {
if damage.iter().any(|geo| lgeo.overlaps(*geo)) { if damage.iter().any(|geo| lgeo.overlaps(*geo)) {
let layer_damage = damage let layer_damage = damage
.iter() .iter()
.filter(|geo| geo.overlaps(lgeo)) .flat_map(|geo| geo.intersection(lgeo))
.map(|geo| geo.intersection(lgeo))
.map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
slog::trace!( slog::trace!(