screencopy: Fix transformed damage calculation

This commit is contained in:
Ivan Molodetskikh
2024-08-08 11:53:42 +03:00
parent 66aae91bca
commit 0f1e44aac6
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -3773,6 +3773,18 @@ impl Niri {
match render_result {
Ok(damages) => {
if let Some(damages) = damages {
// Convert from Physical coordinates back to Buffer coordinates.
let transform = output.current_transform();
let physical_size =
transform.transform_size(screencopy.buffer_size());
let damages = damages.iter().map(|dmg| {
dmg.to_logical(1).to_buffer(
1,
transform.invert(),
&physical_size.to_logical(1),
)
});
screencopy.damage(damages);
queue.pop().submit(false);
} else {
+1 -1
View File
@@ -456,7 +456,7 @@ impl Screencopy {
self.with_damage
}
pub fn damage(&self, damages: &[Rectangle<i32, Physical>]) {
pub fn damage(&self, damages: impl Iterator<Item = Rectangle<i32, smithay::utils::Buffer>>) {
for Rectangle { loc, size } in damages {
self.frame
.damage(loc.x as u32, loc.y as u32, size.w as u32, size.h as u32);