Correct transform for y-inverted buffers

pull/115/head
Andri Yngvason 2021-09-25 00:04:45 +00:00
parent 1a41154b8c
commit 7581cf0bc4
1 changed files with 22 additions and 2 deletions

View File

@ -584,11 +584,31 @@ void wayvnc_process_frame(struct wayvnc* self)
self->damage_area_sum +=
calculate_region_area(&buffer->damage);
struct pixman_region16 damage;
pixman_region_init(&damage);
enum wl_output_transform output_transform, buffer_transform;
output_transform = self->selected_output->transform;
if (buffer->y_inverted) {
buffer_transform = wv_output_transform_compose(output_transform,
WL_OUTPUT_TRANSFORM_FLIPPED_180);
wv_region_transform(&damage, &buffer->damage,
WL_OUTPUT_TRANSFORM_FLIPPED_180,
buffer->width, buffer->height);
} else {
buffer_transform = output_transform;
pixman_region_copy(&damage, &buffer->damage);
}
nvnc_fb_set_transform(buffer->nvnc_fb,
(enum nvnc_transform)self->selected_output->transform);
(enum nvnc_transform)buffer_transform);
nvnc_display_feed_buffer(self->nvnc_display, buffer->nvnc_fb,
&buffer->damage);
&damage);
pixman_region_fini(&damage);
wayvnc_start_capture(self);
}