compositor-wayland: fix shm_buffer damage init

It appears that wayland_shm_buffer::damage is in the global coordinate
space. Therefore initializing it to width x height at 0,0 is not correct
for any output not positioned at 0,0. That is, all outputs after the
first one get it wrong.

Initialize it from the output region, which is in the global coordinate
space.

While at it, add a comment to note that damage is in global coordinate
space. As I can see, this was the last confusion about it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Pekka Paalanen 2017-10-24 10:28:43 +03:00
parent 2b3c97d560
commit 323d4b37a0
1 changed files with 3 additions and 3 deletions

View File

@ -168,7 +168,7 @@ struct wayland_shm_buffer {
struct wl_buffer *buffer;
void *data;
size_t size;
pixman_region32_t damage;
pixman_region32_t damage; /**< in global coords */
int frame_damaged;
pixman_image_t *pm_image;
@ -311,8 +311,8 @@ wayland_output_get_shm_buffer(struct wayland_output *output)
wl_list_init(&sb->free_link);
wl_list_insert(&output->shm.buffers, &sb->link);
pixman_region32_init_rect(&sb->damage, 0, 0,
output->base.width, output->base.height);
pixman_region32_init(&sb->damage);
pixman_region32_copy(&sb->damage, &output->base.region);
sb->frame_damaged = 1;
sb->data = data;