mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
screencopy: Fix transformed damage calculation
This commit is contained in:
+12
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user