diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-05-01 12:59:25 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-05-01 12:59:25 +0100 |
commit | c40d6f536473c4ee5fd310b50697ac7d0816d6e5 (patch) | |
tree | 0e296ea006a5e68f90849ffc135006dd0fe68c20 /src | |
parent | 75ed38539447571ec961c985c8a1e9cbd76573e2 (diff) | |
download | libnsgif-c40d6f536473c4ee5fd310b50697ac7d0816d6e5.tar.gz libnsgif-c40d6f536473c4ee5fd310b50697ac7d0816d6e5.tar.bz2 |
API: Add optional bitmap rowspan callback.
Diffstat (limited to 'src')
-rw-r--r-- | src/gif.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -72,8 +72,11 @@ struct nsgif { uint32_t frame; /** current frame decoded to bitmap */ uint32_t decoded_frame; + /** currently decoded image; stored as bitmap from bitmap_create callback */ nsgif_bitmap_t *frame_image; + /** Row span of frame_image in pixels. */ + uint32_t rowspan; /** Minimum allowable frame delay. */ uint16_t delay_min; @@ -223,6 +226,11 @@ static inline uint32_t* nsgif__bitmap_get( return NULL; } + gif->rowspan = gif->info.width; + if (gif->bitmap.get_rowspan) { + gif->rowspan = gif->bitmap.get_rowspan(gif->frame_image); + } + /* Get the frame data */ assert(gif->bitmap.get_buffer); return (void *)gif->bitmap.get_buffer(gif->frame_image); @@ -463,7 +471,7 @@ static nsgif_error nsgif__decode_complex( uint32_t *frame_scanline; frame_scanline = frame_data + offset_x + - (y + offset_y) * gif->info.width; + (y + offset_y) * gif->rowspan; x = width; while (x > 0) { @@ -594,7 +602,9 @@ static inline nsgif_error nsgif__decode( uint32_t transparency_index = frame->transparency_index; uint32_t *restrict colour_table = gif->colour_table; - if (interlace == false && width == gif->info.width && offset_x == 0) { + if (interlace == false && offset_x == 0 && + width == gif->info.width && + width == gif->rowspan) { ret = nsgif__decode_simple(gif, height, offset_y, data, transparency_index, frame_data, colour_table); |