diff --git a/src/backend/renderer/utils/mod.rs b/src/backend/renderer/utils/mod.rs index ae61bfd..bbf65a8 100644 --- a/src/backend/renderer/utils/mod.rs +++ b/src/backend/renderer/utils/mod.rs @@ -165,8 +165,7 @@ where let new_damage = damage .iter() .cloned() - .filter(|geo| geo.overlaps(rect)) - .map(|geo| geo.intersection(rect)) + .flat_map(|geo| geo.intersection(rect)) .map(|mut geo| { geo.loc -= rect.loc; geo diff --git a/src/desktop/space.rs b/src/desktop/space.rs index 1dd1828..63e4bea 100644 --- a/src/desktop/space.rs +++ b/src/desktop/space.rs @@ -570,8 +570,7 @@ impl Space { if damage.iter().any(|geo| lgeo.overlaps(*geo)) { let layer_damage = damage .iter() - .filter(|geo| geo.overlaps(lgeo)) - .map(|geo| geo.intersection(lgeo)) + .flat_map(|geo| geo.intersection(lgeo)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size)) .collect::>(); slog::trace!( @@ -600,8 +599,7 @@ impl Space { loc -= output_geo.loc; let win_damage = damage .iter() - .filter(|geo| geo.overlaps(wgeo)) - .map(|geo| geo.intersection(wgeo)) + .flat_map(|geo| geo.intersection(wgeo)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - loc, geo.size)) .collect::>(); slog::trace!( @@ -631,8 +629,7 @@ impl Space { if damage.iter().any(|geo| lgeo.overlaps(*geo)) { let layer_damage = damage .iter() - .filter(|geo| geo.overlaps(lgeo)) - .map(|geo| geo.intersection(lgeo)) + .flat_map(|geo| geo.intersection(lgeo)) .map(|geo| Rectangle::from_loc_and_size(geo.loc - lgeo.loc, geo.size)) .collect::>(); slog::trace!(