summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2021-12-14 13:05:50 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2021-12-14 13:05:50 +0000
commitcfe1f467ed248ebd8131b29634eadac89e00aa4d (patch)
treec13c962dcdfe54276f2696f3dbbf85b394a2cc63
parentce17f177e640bdd979959782183ced4e636d7c98 (diff)
downloadlibnsgif-cfe1f467ed248ebd8131b29634eadac89e00aa4d.tar.gz
libnsgif-cfe1f467ed248ebd8131b29634eadac89e00aa4d.tar.bz2
API: Rename nsgif_animation to nsgif.
-rw-r--r--include/nsgif.h14
-rw-r--r--src/gif.c54
-rw-r--r--test/decode_gif.c4
3 files changed, 36 insertions, 36 deletions
diff --git a/include/nsgif.h b/include/nsgif.h
index 8e84519..5e69b7e 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -102,7 +102,7 @@ typedef struct nsgif_bitmap_cb_vt {
} nsgif_bitmap_cb_vt;
/** GIF animation data */
-typedef struct nsgif_animation {
+typedef struct nsgif {
/** LZW decode context */
void *lzw_ctx;
/** callbacks for bitmap functions */
@@ -159,12 +159,12 @@ typedef struct nsgif_animation {
unsigned prev_width;
/** previous frame height */
unsigned prev_height;
-} nsgif_animation;
+} nsgif;
/**
- * Initialises necessary nsgif_animation members.
+ * Initialises necessary nsgif members.
*/
-void nsgif_create(nsgif_animation *gif, nsgif_bitmap_cb_vt *bitmap_callbacks);
+void nsgif_create(nsgif *gif, nsgif_bitmap_cb_vt *bitmap_callbacks);
/**
* Initialises any workspace held by the animation and attempts to decode
@@ -179,7 +179,7 @@ void nsgif_create(nsgif_animation *gif, nsgif_bitmap_cb_vt *bitmap_callbacks);
* - NSGIF_OK for successful decoding
* - NSGIF_WORKING for successful decoding if more frames are expected
*/
-nsgif_result nsgif_initialise(nsgif_animation *gif, size_t size, const uint8_t *data);
+nsgif_result nsgif_initialise(nsgif *gif, size_t size, const uint8_t *data);
/**
* Decodes a GIF frame.
@@ -191,11 +191,11 @@ nsgif_result nsgif_initialise(nsgif_animation *gif, size_t size, const uint8_t *
* - NSGIF_INSUFFICIENT_MEMORY for insufficient memory to process
* - NSGIF_OK for successful decoding
*/
-nsgif_result nsgif_decode_frame(nsgif_animation *gif, uint32_t frame);
+nsgif_result nsgif_decode_frame(nsgif *gif, uint32_t frame);
/**
* Releases any workspace held by a gif
*/
-void nsgif_finalise(nsgif_animation *gif);
+void nsgif_finalise(nsgif *gif);
#endif
diff --git a/src/gif.c b/src/gif.c
index 96de694..2c11466 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -88,7 +88,7 @@ static nsgif_result nsgif__error_from_lzw(lzw_result l_res)
* \return NSGIF_INSUFFICIENT_MEMORY for a memory error NSGIF_OK for success
*/
static nsgif_result nsgif__initialise_sprite(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t width,
uint32_t height)
{
@@ -113,7 +113,7 @@ static nsgif_result nsgif__initialise_sprite(
* \return Client pixel buffer for rendering into.
*/
static inline uint32_t* nsgif__bitmap_get(
- struct nsgif_animation *gif)
+ struct nsgif *gif)
{
nsgif_result ret;
@@ -134,7 +134,7 @@ static inline uint32_t* nsgif__bitmap_get(
* \param[in] gif The gif object we're decoding.
*/
static inline void nsgif__bitmap_modified(
- const struct nsgif_animation *gif)
+ const struct nsgif *gif)
{
if (gif->bitmap.modified) {
gif->bitmap.modified(gif->frame_image);
@@ -148,7 +148,7 @@ static inline void nsgif__bitmap_modified(
* \param[in] frame The frame that has been decoded.
*/
static inline void nsgif__bitmap_set_opaque(
- const struct nsgif_animation *gif,
+ const struct nsgif *gif,
const struct nsgif_frame *frame)
{
if (gif->bitmap.set_opaque) {
@@ -166,7 +166,7 @@ static inline void nsgif__bitmap_set_opaque(
* \return true if the bitmap is opaque, false otherwise.
*/
static inline bool nsgif__bitmap_get_opaque(
- const struct nsgif_animation *gif)
+ const struct nsgif *gif)
{
if (gif->bitmap.test_opaque) {
return gif->bitmap.test_opaque(
@@ -177,7 +177,7 @@ static inline bool nsgif__bitmap_get_opaque(
}
static void nsgif__record_frame(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
const uint32_t *bitmap)
{
bool need_alloc = gif->prev_frame == NULL;
@@ -218,7 +218,7 @@ static void nsgif__record_frame(
}
static nsgif_result nsgif__recover_frame(
- const struct nsgif_animation *gif,
+ const struct nsgif *gif,
uint32_t *bitmap)
{
const uint32_t *prev_frame = gif->prev_frame;
@@ -292,7 +292,7 @@ static inline bool nsgif__next_row(uint32_t interlace,
}
static nsgif_result nsgif__decode_complex(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t width,
uint32_t height,
uint32_t offset_x,
@@ -372,7 +372,7 @@ static nsgif_result nsgif__decode_complex(
}
static nsgif_result nsgif__decode_simple(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t height,
uint32_t offset_y,
const uint8_t *data,
@@ -420,7 +420,7 @@ static nsgif_result nsgif__decode_simple(
}
static inline nsgif_result nsgif__decode(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t *data,
uint32_t *restrict frame_data)
@@ -460,7 +460,7 @@ static inline nsgif_result nsgif__decode(
* \param[in] bitmap The bitmap to clear the frame in.
*/
static void nsgif__restore_bg(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
uint32_t *bitmap)
{
@@ -497,7 +497,7 @@ static void nsgif__restore_bg(
}
static nsgif_result nsgif__update_bitmap(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t *data,
uint32_t frame_idx)
@@ -620,7 +620,7 @@ static nsgif_result nsgif__parse_extension_graphic_control(
* NSGIF_OK for success.
*/
static nsgif_result nsgif__parse_extension_application(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
const uint8_t *data,
size_t len)
{
@@ -656,7 +656,7 @@ static nsgif_result nsgif__parse_extension_application(
* NSGIF_OK for success.
*/
static nsgif_result nsgif__parse_frame_extensions(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t **pos,
bool decode)
@@ -773,7 +773,7 @@ static nsgif_result nsgif__parse_frame_extensions(
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__parse_image_descriptor(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t **pos,
bool decode)
@@ -830,7 +830,7 @@ static nsgif_result nsgif__parse_image_descriptor(
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__colour_table_extract(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t *colour_table,
size_t colour_table_entries,
const uint8_t **pos,
@@ -879,7 +879,7 @@ static nsgif_result nsgif__colour_table_extract(
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__parse_colour_table(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t **pos,
bool decode)
@@ -917,7 +917,7 @@ static nsgif_result nsgif__parse_colour_table(
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__parse_image_data(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
struct nsgif_frame *frame,
const uint8_t **pos,
bool decode)
@@ -995,7 +995,7 @@ static nsgif_result nsgif__parse_image_data(
}
static struct nsgif_frame *nsgif__get_frame(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t frame_idx)
{
struct nsgif_frame *frame;
@@ -1044,7 +1044,7 @@ static struct nsgif_frame *nsgif__get_frame(
* - NSGIF_WORKING for successful decoding if more frames are expected
*/
static nsgif_result nsgif__process_frame(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
uint32_t frame_idx,
bool decode)
{
@@ -1122,9 +1122,9 @@ cleanup:
}
/* exported function documented in libnsgif.h */
-void nsgif_create(nsgif_animation *gif, nsgif_bitmap_cb_vt *bitmap)
+void nsgif_create(nsgif *gif, nsgif_bitmap_cb_vt *bitmap)
{
- memset(gif, 0, sizeof(nsgif_animation));
+ memset(gif, 0, sizeof(nsgif));
gif->bitmap = *bitmap;
gif->decoded_frame = NSGIF_INVALID_FRAME;
gif->prev_index = NSGIF_INVALID_FRAME;
@@ -1144,7 +1144,7 @@ void nsgif_create(nsgif_animation *gif, nsgif_bitmap_cb_vt *bitmap)
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__parse_header(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
const uint8_t **pos,
bool strict)
{
@@ -1192,7 +1192,7 @@ static nsgif_result nsgif__parse_header(
* \return NSGIF_OK on success, appropriate error otherwise.
*/
static nsgif_result nsgif__parse_logical_screen_descriptor(
- struct nsgif_animation *gif,
+ struct nsgif *gif,
const uint8_t **pos)
{
const uint8_t *data = *pos;
@@ -1215,7 +1215,7 @@ static nsgif_result nsgif__parse_logical_screen_descriptor(
}
/* exported function documented in libnsgif.h */
-nsgif_result nsgif_initialise(nsgif_animation *gif, size_t size, const uint8_t *data)
+nsgif_result nsgif_initialise(nsgif *gif, size_t size, const uint8_t *data)
{
const uint8_t *nsgif_data;
nsgif_result ret;
@@ -1357,13 +1357,13 @@ nsgif_result nsgif_initialise(nsgif_animation *gif, size_t size, const uint8_t *
}
/* exported function documented in libnsgif.h */
-nsgif_result nsgif_decode_frame(nsgif_animation *gif, uint32_t frame)
+nsgif_result nsgif_decode_frame(nsgif *gif, uint32_t frame)
{
return nsgif__process_frame(gif, frame, true);
}
/* exported function documented in libnsgif.h */
-void nsgif_finalise(nsgif_animation *gif)
+void nsgif_finalise(nsgif *gif)
{
/* Release all our memory blocks */
if (gif->frame_image) {
diff --git a/test/decode_gif.c b/test/decode_gif.c
index 20cb571..a20d5f4 100644
--- a/test/decode_gif.c
+++ b/test/decode_gif.c
@@ -125,7 +125,7 @@ static void warning(const char *context, nsgif_result code)
fprintf(stderr, "\n");
}
-static void write_ppm(FILE* fh, const char *name, nsgif_animation *gif,
+static void write_ppm(FILE* fh, const char *name, nsgif *gif,
bool no_write)
{
unsigned int i;
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
bitmap_test_opaque,
bitmap_modified
};
- nsgif_animation gif;
+ nsgif gif;
size_t size;
nsgif_result code;
unsigned char *data;