desktop: clamp damage to bbox

This commit is contained in:
Victor Brekenfeld 2021-12-20 19:13:30 +01:00
parent 827a3c8c2a
commit 5b85333eaf
2 changed files with 14 additions and 4 deletions

View File

@ -438,15 +438,20 @@ impl LayerSurface {
) -> Vec<Rectangle<i32, Logical>> {
let mut damage = Vec::new();
if let Some(surface) = self.get_surface() {
damage.extend(damage_from_surface_tree(surface, (0, 0), for_values));
damage.extend(
damage_from_surface_tree(surface, (0, 0), for_values)
.into_iter()
.flat_map(|rect| rect.intersection(self.bbox())),
);
for (popup, location) in PopupManager::popups_for_surface(surface)
.ok()
.into_iter()
.flatten()
{
if let Some(surface) = popup.get_surface() {
let bbox = bbox_from_surface_tree(surface, location);
let popup_damage = damage_from_surface_tree(surface, location, for_values);
damage.extend(popup_damage);
damage.extend(popup_damage.into_iter().flat_map(|rect| rect.intersection(bbox)));
}
}
}

View File

@ -266,15 +266,20 @@ impl Window {
) -> Vec<Rectangle<i32, Logical>> {
let mut damage = Vec::new();
if let Some(surface) = self.0.toplevel.get_surface() {
damage.extend(damage_from_surface_tree(surface, (0, 0), for_values));
damage.extend(
damage_from_surface_tree(surface, (0, 0), for_values)
.into_iter()
.flat_map(|rect| rect.intersection(self.bbox())),
);
for (popup, location) in PopupManager::popups_for_surface(surface)
.ok()
.into_iter()
.flatten()
{
if let Some(surface) = popup.get_surface() {
let bbox = bbox_from_surface_tree(surface, location);
let popup_damage = damage_from_surface_tree(surface, location, for_values);
damage.extend(popup_damage);
damage.extend(popup_damage.into_iter().flat_map(|rect| rect.intersection(bbox)));
}
}
}