wlr_surface: fix surface damage transformation

Damage tracking on transformed surfaces now work (see
"weston-simple-damage --rotation=90"), using either of buffer or surface
damage.
This commit is contained in:
random human 2018-09-24 20:22:52 +05:30
parent f5658c2ca2
commit 971cbeaa19
No known key found for this signature in database
GPG Key ID: 73E5A60444CC77A3
2 changed files with 6 additions and 5 deletions

View File

@ -696,8 +696,7 @@ static void damage_from_surface(struct wlr_surface *surface, int sx, int sy,
int center_x = box.x + box.width/2; int center_x = box.x + box.width/2;
int center_y = box.y + box.height/2; int center_y = box.y + box.height/2;
enum wl_output_transform transform = enum wl_output_transform transform = surface->current.transform;
wlr_output_transform_invert(surface->current.transform);
pixman_region32_t damage; pixman_region32_t damage;
pixman_region32_init(&damage); pixman_region32_init(&damage);

View File

@ -7,6 +7,7 @@
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_region.h> #include <wlr/types/wlr_region.h>
#include <wlr/types/wlr_surface.h> #include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include "util/signal.h" #include "util/signal.h"
@ -198,7 +199,8 @@ static void surface_update_damage(pixman_region32_t *buffer_damage,
pixman_region32_init(&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,
current->transform, current->buffer_width, current->buffer_height); wlr_output_transform_invert(current->transform),
current->width, current->height);
wlr_region_scale(&surface_damage, &surface_damage, current->scale); wlr_region_scale(&surface_damage, &surface_damage, current->scale);
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);
@ -307,8 +309,8 @@ static void surface_apply_damage(struct wlr_surface *surface) {
pixman_region32_init(&surface_damage); pixman_region32_init(&surface_damage);
pixman_region32_copy(&surface_damage, &surface->current.surface_damage); pixman_region32_copy(&surface_damage, &surface->current.surface_damage);
wlr_region_transform(&surface_damage, &surface_damage, wlr_region_transform(&surface_damage, &surface_damage,
surface->current.transform, wlr_output_transform_invert(surface->current.transform),
surface->current.buffer_width, surface->current.buffer_height); surface->current.width, surface->current.height);
wlr_region_scale(&surface_damage, &surface_damage, wlr_region_scale(&surface_damage, &surface_damage,
surface->current.scale); surface->current.scale);
pixman_region32_union(&damage, &damage, &surface_damage); pixman_region32_union(&damage, &damage, &surface_damage);