aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-01-28 21:29:51 +0100
committeremersion <contact@emersion.fr>2018-01-28 21:29:51 +0100
commite049610b47b2d6191e1b0feb72eda1431d12f37c (patch)
treebb6ce133d5c27743c7d3b1d9e772d997598ea6af
parent1ee61dbd0f6ab8cf9dfafb085707bd67cca50e70 (diff)
surface: copy buffer damage to surface damage
-rw-r--r--types/wlr_surface.c20
1 files 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