From 03c229f4ce989c192436f00d12c445ca9b29b6fc Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 1 Aug 2022 13:01:38 +0300 Subject: [PATCH] screen-share: use read_format consistently This was using read_format for the read_pixels() call, and then using a hardcoded format for interpreting the data received from read_pixels(). That works only by accident, read_format being the same as the hardcoded format. Use read_format for the interpreting too. This should guarantee the read pixels are processed correctly. Found by code inspection. Signed-off-by: Pekka Paalanen --- compositor/screen-share.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compositor/screen-share.c b/compositor/screen-share.c index b820278f..550d9c7b 100644 --- a/compositor/screen-share.c +++ b/compositor/screen-share.c @@ -828,6 +828,8 @@ shared_output_repainted(struct wl_listener *listener, void *data) pixman_box32_t *r; pixman_image_t *damaged_image; pixman_transform_t transform; + const pixman_format_code_t pixman_format = + so->output->compositor->read_format; width = so->output->current_mode->width; height = so->output->current_mode->height; @@ -882,13 +884,13 @@ shared_output_repainted(struct wl_listener *listener, void *data) y_orig = y; so->output->compositor->renderer->read_pixels( - so->output, so->output->compositor->read_format, + so->output, pixman_format, so->tmp_data, x, y_orig, width, height); - damaged_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, + damaged_image = pixman_image_create_bits(pixman_format, width, height, so->tmp_data, - (PIXMAN_FORMAT_BPP(PIXMAN_a8r8g8b8) / 8) * width); + (PIXMAN_FORMAT_BPP(pixman_format) / 8) * width); if (!damaged_image) goto err_pixman_init;