sixel: fix resizing issues (#109)

Fixes #108
This commit is contained in:
veltza 2023-12-12 22:29:26 +02:00 committed by GitHub
parent 3fcf0e3db7
commit 76cb5801f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 43 deletions

12
st.c
View file

@ -2650,16 +2650,16 @@ strhandle(void)
term.mode &= ~MODE_SIXEL;
new_image = malloc(sizeof(ImageList));
memset(new_image, 0, sizeof(ImageList));
if (sixel_parser_finalize(&sixel_st, &new_image->pixels) != 0) {
perror("sixel_parser_finalize() failed");
sixel_parser_deinit(&sixel_st);
free(new_image);
return;
}
new_image->x = term.c.x;
new_image->y = term.c.y;
new_image->width = sixel_st.image.width;
new_image->height = sixel_st.image.height;
new_image->pixels = malloc(new_image->width * new_image->height * 4);
if (sixel_parser_finalize(&sixel_st, new_image->pixels) != 0) {
perror("sixel_parser_finalize() failed");
sixel_parser_deinit(&sixel_st);
return;
}
sixel_parser_deinit(&sixel_st);
if (term.images) {
ImageList *im;