From 8d5541b27f783a06cc51448b552432291b5e8cce Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 12 Nov 2024 23:14:50 -0500 Subject: [PATCH] fix: apply transform to damage before blitting --- src/backend/kms/surface/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/kms/surface/mod.rs b/src/backend/kms/surface/mod.rs index c09856c1..0353c7db 100644 --- a/src/backend/kms/surface/mod.rs +++ b/src/backend/kms/surface/mod.rs @@ -1205,13 +1205,23 @@ impl SurfaceThreadState { .into_iter() .flatten(); + // If the screen is rotated, we must convert damage to match output. + let adjusted = damage.iter().copied().map(|mut d| { + d.size = d + .size + .to_logical(1) + .to_buffer(1, output_transform) + .to_logical(1, Transform::Normal) + .to_physical(1); + d + }); match frame_result .blit_frame_result( output_size, output_transform, output_scale, &mut renderer, - damage.iter().copied(), + adjusted, filter, ) .map_err(|err| match err {