From 70784e1bcc723627897eacb6b54da3a01f228638 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 6 Feb 2022 17:44:12 +0000 Subject: [PATCH] cursor: Fix alpha mask stride --- src/cursor.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/cursor.c b/src/cursor.c index a2c063b..3e22759 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -69,15 +69,14 @@ int cursor_encode(struct vec* dst, struct rfb_pixel_format* pixfmt, dstdata = dst->data; dstdata += dst->len; - if(image->width == image->stride) { - if (!extract_alpha_mask(dstdata, image->addr, - image->fourcc_format, size)) + for (int y = 0; y < image->height; ++y) { + if (!extract_alpha_mask(dstdata + y * UDIV_UP(image->width, 8), + (uint32_t*)image->addr + y * image->stride, + image->fourcc_format, image->width)) return -1; - } else { - // TODO - abort(); + + dst->len += UDIV_UP(image->width, 8); } - dst->len += UDIV_UP(size, 8); return 0; }