bopti: fix p4 stride omission from 1384c54b5

This commit is contained in:
Lephe 2022-01-18 13:50:04 +01:00
parent d8b85a9fab
commit 36d66a6317
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 4 additions and 2 deletions

View File

@ -59,11 +59,13 @@ void bopti_render(bopti_image_t const *img, struct box *box)
uint16_t const *palette = data;
data += 32;
int true_width = img->width + (img->width & 1);
/* Due to nibble alignment being a hassle, in this function the
input stride is expressed in pixels. */
int in = img->width - w + (img->width & 1);
int in = true_width - w;
/* Also we don't move pointers, we just use pixel offsets. */
int offset = img->width * box->top + box->left;
int offset = true_width * box->top + box->left;
bopti_p4(data, target, w, h, in, out, palette, img->alpha,
offset);