wlr_surface: fix surface damage on resize

Instead of damaging the buffer, damage only the surface on surface (not
buffer) resize.
This commit is contained in:
random human 2018-09-25 00:49:18 +05:30
parent 971cbeaa19
commit 3fd5da58a0
No known key found for this signature in database
GPG Key ID: 73E5A60444CC77A3
1 changed files with 16 additions and 16 deletions

View File

@ -173,8 +173,11 @@ static void surface_update_damage(pixman_region32_t *buffer_damage,
struct wlr_surface_state *previous, struct wlr_surface_state *current) { struct wlr_surface_state *previous, struct wlr_surface_state *current) {
pixman_region32_clear(buffer_damage); pixman_region32_clear(buffer_damage);
if (current->buffer_width != previous->buffer_width || pixman_region32_t surface_damage;
current->buffer_height != previous->buffer_height || pixman_region32_init(&surface_damage);
if (current->width != previous->width ||
current->height != previous->height ||
current->dx != 0 || current->dy != 0) { current->dx != 0 || current->dy != 0) {
// Damage the whole surface on resize or move // Damage the whole surface on resize or move
int prev_x = -current->dx; int prev_x = -current->dx;
@ -185,19 +188,17 @@ static void surface_update_damage(pixman_region32_t *buffer_damage,
prev_y = tmp; prev_y = tmp;
} }
pixman_region32_union_rect(buffer_damage, buffer_damage, pixman_region32_union_rect(&surface_damage, &surface_damage, prev_x,
prev_x * previous->scale, prev_y * previous->scale, prev_y, previous->width, previous->height);
previous->buffer_width, previous->buffer_height); pixman_region32_union_rect(&surface_damage, &surface_damage, 0, 0,
pixman_region32_union_rect(buffer_damage, buffer_damage, 0, 0, current->width, current->height);
current->buffer_width, current->buffer_height);
} else { } else {
// Copy over surface damage + buffer damage // Copy over surface damage + buffer damage
pixman_region32_union(buffer_damage, buffer_damage, pixman_region32_union(buffer_damage, buffer_damage,
&current->buffer_damage); &current->buffer_damage);
pixman_region32_t surface_damage;
pixman_region32_init(&surface_damage);
pixman_region32_copy(&surface_damage, &current->surface_damage); pixman_region32_copy(&surface_damage, &current->surface_damage);
}
wlr_region_transform(&surface_damage, &surface_damage, wlr_region_transform(&surface_damage, &surface_damage,
wlr_output_transform_invert(current->transform), wlr_output_transform_invert(current->transform),
current->width, current->height); current->width, current->height);
@ -205,7 +206,6 @@ static void surface_update_damage(pixman_region32_t *buffer_damage,
pixman_region32_union(buffer_damage, buffer_damage, &surface_damage); pixman_region32_union(buffer_damage, buffer_damage, &surface_damage);
pixman_region32_fini(&surface_damage); pixman_region32_fini(&surface_damage);
} }
}
static void surface_state_copy(struct wlr_surface_state *state, static void surface_state_copy(struct wlr_surface_state *state,
struct wlr_surface_state *next) { struct wlr_surface_state *next) {