From e049610b47b2d6191e1b0feb72eda1431d12f37c Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 28 Jan 2018 21:29:51 +0100 Subject: [PATCH] surface: copy buffer damage to surface damage --- types/wlr_surface.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/types/wlr_surface.c b/types/wlr_surface.c index f93b2563..045e3670 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -233,16 +233,30 @@ static void wlr_surface_move_state(struct wlr_surface *surface, update_damage = true; } if (update_damage) { - pixman_region32_t buffer_damage; + pixman_region32_t buffer_damage, surface_damage; pixman_region32_init(&buffer_damage); + pixman_region32_init(&surface_damage); + + // Surface to buffer damage pixman_region32_copy(&buffer_damage, &state->surface_damage); wlr_region_transform(&buffer_damage, &buffer_damage, wlr_output_transform_invert(state->transform), state->width, state->height); wlr_region_scale(&buffer_damage, &buffer_damage, state->scale); - pixman_region32_union(&state->buffer_damage, - &state->buffer_damage, &buffer_damage); + + // Buffer to surface damage + pixman_region32_copy(&surface_damage, &state->buffer_damage); + wlr_region_transform(&surface_damage, &surface_damage, state->transform, + state->buffer_width, state->buffer_height); + wlr_region_scale(&surface_damage, &surface_damage, 1.0f/state->scale); + + pixman_region32_union(&state->buffer_damage, &state->buffer_damage, + &buffer_damage); + pixman_region32_union(&state->surface_damage, &state->surface_damage, + &surface_damage); + pixman_region32_fini(&buffer_damage); + pixman_region32_fini(&surface_damage); } if ((next->invalid & WLR_SURFACE_INVALID_OPAQUE_REGION)) { // TODO: process buffer