From 7f375b8afb6e4b64f4b1d3c0522a25c48af25a39 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 15 Oct 2024 15:33:24 +0300 Subject: [PATCH] scene: crop output buffer damage before adding This piece of logic was accidentally removed in 009515161bd97d8f920d72d31ef462f2608688e8. --- types/scene/wlr_scene.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index b5863f47..8cbb0b98 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -355,16 +355,22 @@ static void transform_output_box(struct wlr_box *box, const struct render_data * } static void scene_output_damage(struct wlr_scene_output *scene_output, - const pixman_region32_t *frame_damage) { - if (!pixman_region32_not_empty(frame_damage)) { - return; - } + const pixman_region32_t *damage) { + struct wlr_output *output = scene_output->output; - wlr_output_schedule_frame(scene_output->output); - wlr_damage_ring_add(&scene_output->damage_ring, frame_damage); + pixman_region32_t clipped; + pixman_region32_init(&clipped); + pixman_region32_intersect_rect(&clipped, damage, 0, 0, output->width, output->height); + + if (pixman_region32_not_empty(&clipped)) { + wlr_output_schedule_frame(scene_output->output); + wlr_damage_ring_add(&scene_output->damage_ring, &clipped); + + pixman_region32_union(&scene_output->pending_commit_damage, + &scene_output->pending_commit_damage, &clipped); + } - pixman_region32_union(&scene_output->pending_commit_damage, - &scene_output->pending_commit_damage, frame_damage); + pixman_region32_fini(&clipped); } static void scene_output_damage_whole(struct wlr_scene_output *scene_output) {