summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2021-11-05 12:18:25 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2021-11-05 12:18:25 +0000
commitd1762afcee8b6541a974eeb37edea2a828096b8a (patch)
tree7628ac297766436de4c754aaf4a9c17414a91b3f
parent947586eb1b14c267ee996ba655af13899488c0f3 (diff)
downloadlibnsgif-d1762afcee8b6541a974eeb37edea2a828096b8a.tar.gz
libnsgif-d1762afcee8b6541a974eeb37edea2a828096b8a.tar.bz2
API: Clean up public header indentation.
-rw-r--r--include/libnsgif.h228
1 files changed, 113 insertions, 115 deletions
diff --git a/include/libnsgif.h b/include/libnsgif.h
index 36f59a4..adbacbe 100644
--- a/include/libnsgif.h
+++ b/include/libnsgif.h
@@ -20,50 +20,50 @@
/* Error return values */
typedef enum {
- GIF_WORKING = 1,
- GIF_OK = 0,
- GIF_INSUFFICIENT_FRAME_DATA = -1,
- GIF_FRAME_DATA_ERROR = -2,
- GIF_INSUFFICIENT_DATA = -3,
- GIF_DATA_ERROR = -4,
- GIF_INSUFFICIENT_MEMORY = -5,
- GIF_FRAME_NO_DISPLAY = -6,
- GIF_END_OF_FRAME = -7
+ GIF_WORKING = 1,
+ GIF_OK = 0,
+ GIF_INSUFFICIENT_FRAME_DATA = -1,
+ GIF_FRAME_DATA_ERROR = -2,
+ GIF_INSUFFICIENT_DATA = -3,
+ GIF_DATA_ERROR = -4,
+ GIF_INSUFFICIENT_MEMORY = -5,
+ GIF_FRAME_NO_DISPLAY = -6,
+ GIF_END_OF_FRAME = -7
} gif_result;
/** GIF frame data */
typedef struct gif_frame {
- /** whether the frame should be displayed/animated */
- bool display;
- /** delay (in cs) before animating the frame */
- unsigned int frame_delay;
-
- /* Internal members are listed below */
-
- /** offset (in bytes) to the GIF frame data */
- unsigned int frame_pointer;
- /** whether the frame has previously been used */
- bool virgin;
- /** whether the frame is totally opaque */
- bool opaque;
- /** whether a forcable screen redraw is required */
- bool redraw_required;
- /** how the previous frame should be disposed; affects plotting */
- unsigned char disposal_method;
- /** whether we acknoledge transparency */
- bool transparency;
- /** the index designating a transparent pixel */
- unsigned int transparency_index;
- /** x co-ordinate of redraw rectangle */
- unsigned int redraw_x;
- /** y co-ordinate of redraw rectangle */
- unsigned int redraw_y;
- /** width of redraw rectangle */
- unsigned int redraw_width;
- /** height of redraw rectangle */
- unsigned int redraw_height;
- /* Frame flags */
- unsigned int flags;
+ /** whether the frame should be displayed/animated */
+ bool display;
+ /** delay (in cs) before animating the frame */
+ unsigned int frame_delay;
+
+ /* Internal members are listed below */
+
+ /** offset (in bytes) to the GIF frame data */
+ unsigned int frame_pointer;
+ /** whether the frame has previously been used */
+ bool virgin;
+ /** whether the frame is totally opaque */
+ bool opaque;
+ /** whether a forcable screen redraw is required */
+ bool redraw_required;
+ /** how the previous frame should be disposed; affects plotting */
+ unsigned char disposal_method;
+ /** whether we acknoledge transparency */
+ bool transparency;
+ /** the index designating a transparent pixel */
+ unsigned int transparency_index;
+ /** x co-ordinate of redraw rectangle */
+ unsigned int redraw_x;
+ /** y co-ordinate of redraw rectangle */
+ unsigned int redraw_y;
+ /** width of redraw rectangle */
+ unsigned int redraw_width;
+ /** height of redraw rectangle */
+ unsigned int redraw_height;
+ /* Frame flags */
+ unsigned int flags;
} gif_frame;
/* API for Bitmap callbacks */
@@ -76,81 +76,81 @@ typedef void (*gif_bitmap_cb_modified)(void *bitmap);
/** Bitmap callbacks function table */
typedef struct gif_bitmap_callback_vt {
- /** Create a bitmap. */
- gif_bitmap_cb_create bitmap_create;
- /** Free a bitmap. */
- gif_bitmap_cb_destroy bitmap_destroy;
- /** Return a pointer to the pixel data in a bitmap. */
- gif_bitmap_cb_get_buffer bitmap_get_buffer;
-
- /* Members below are optional */
-
- /** Sets whether a bitmap should be plotted opaque. */
- gif_bitmap_cb_set_opaque bitmap_set_opaque;
- /** Tests whether a bitmap has an opaque alpha channel. */
- gif_bitmap_cb_test_opaque bitmap_test_opaque;
- /** The bitmap image has changed, so flush any persistant cache. */
- gif_bitmap_cb_modified bitmap_modified;
+ /** Create a bitmap. */
+ gif_bitmap_cb_create bitmap_create;
+ /** Free a bitmap. */
+ gif_bitmap_cb_destroy bitmap_destroy;
+ /** Return a pointer to the pixel data in a bitmap. */
+ gif_bitmap_cb_get_buffer bitmap_get_buffer;
+
+ /* Members below are optional */
+
+ /** Sets whether a bitmap should be plotted opaque. */
+ gif_bitmap_cb_set_opaque bitmap_set_opaque;
+ /** Tests whether a bitmap has an opaque alpha channel. */
+ gif_bitmap_cb_test_opaque bitmap_test_opaque;
+ /** The bitmap image has changed, so flush any persistant cache. */
+ gif_bitmap_cb_modified bitmap_modified;
} gif_bitmap_callback_vt;
/** GIF animation data */
typedef struct gif_animation {
- /** LZW decode context */
- void *lzw_ctx;
- /** callbacks for bitmap functions */
- gif_bitmap_callback_vt bitmap_callbacks;
- /** pointer to GIF data */
- const uint8_t *gif_data;
- /** width of GIF (may increase during decoding) */
- unsigned int width;
- /** heigth of GIF (may increase during decoding) */
- unsigned int height;
- /** number of frames decoded */
- unsigned int frame_count;
- /** number of frames partially decoded */
- unsigned int frame_count_partial;
- /** decoded frames */
- gif_frame *frames;
- /** current frame decoded to bitmap */
- int decoded_frame;
- /** currently decoded image; stored as bitmap from bitmap_create callback */
- void *frame_image;
- /** number of times to loop animation */
- int loop_count;
-
- /* Internal members are listed below */
-
- /** current index into GIF data */
- unsigned int buffer_position;
- /** total number of bytes of GIF data available */
- unsigned int buffer_size;
- /** current number of frame holders */
- unsigned int frame_holders;
- /** background index */
- unsigned int bg_index;
- /** background colour */
- unsigned int bg_colour;
- /** image aspect ratio (ignored) */
- unsigned int aspect_ratio;
- /** size of colour table (in entries) */
- unsigned int colour_table_size;
- /** whether the GIF has a global colour table */
- bool global_colours;
- /** global colour table */
- unsigned int *global_colour_table;
- /** local colour table */
- unsigned int *local_colour_table;
- /** current colour table */
- unsigned int *colour_table;
-
- /** previous frame for GIF_FRAME_RESTORE */
- void *prev_frame;
- /** previous frame index */
- int prev_index;
- /** previous frame width */
- unsigned prev_width;
- /** previous frame height */
- unsigned prev_height;
+ /** LZW decode context */
+ void *lzw_ctx;
+ /** callbacks for bitmap functions */
+ gif_bitmap_callback_vt bitmap_callbacks;
+ /** pointer to GIF data */
+ const uint8_t *gif_data;
+ /** width of GIF (may increase during decoding) */
+ unsigned int width;
+ /** heigth of GIF (may increase during decoding) */
+ unsigned int height;
+ /** number of frames decoded */
+ unsigned int frame_count;
+ /** number of frames partially decoded */
+ unsigned int frame_count_partial;
+ /** decoded frames */
+ gif_frame *frames;
+ /** current frame decoded to bitmap */
+ int decoded_frame;
+ /** currently decoded image; stored as bitmap from bitmap_create callback */
+ void *frame_image;
+ /** number of times to loop animation */
+ int loop_count;
+
+ /* Internal members are listed below */
+
+ /** current index into GIF data */
+ unsigned int buffer_position;
+ /** total number of bytes of GIF data available */
+ unsigned int buffer_size;
+ /** current number of frame holders */
+ unsigned int frame_holders;
+ /** background index */
+ unsigned int bg_index;
+ /** background colour */
+ unsigned int bg_colour;
+ /** image aspect ratio (ignored) */
+ unsigned int aspect_ratio;
+ /** size of colour table (in entries) */
+ unsigned int colour_table_size;
+ /** whether the GIF has a global colour table */
+ bool global_colours;
+ /** global colour table */
+ unsigned int *global_colour_table;
+ /** local colour table */
+ unsigned int *local_colour_table;
+ /** current colour table */
+ unsigned int *colour_table;
+
+ /** previous frame for GIF_FRAME_RESTORE */
+ void *prev_frame;
+ /** previous frame index */
+ int prev_index;
+ /** previous frame width */
+ unsigned prev_width;
+ /** previous frame height */
+ unsigned prev_height;
} gif_animation;
/**
@@ -163,7 +163,7 @@ void gif_create(gif_animation *gif, gif_bitmap_callback_vt *bitmap_callbacks);
* any information that hasn't already been decoded.
* If an error occurs, all previously decoded frames are retained.
*
- * @return Error return value.
+ * \return Error return value.
* - GIF_FRAME_DATA_ERROR for GIF frame data error
* - GIF_INSUFFICIENT_FRAME_DATA for insufficient data to process
* any more frames
@@ -178,9 +178,7 @@ gif_result gif_initialise(gif_animation *gif, size_t size, const uint8_t *data);
/**
* Decodes a GIF frame.
*
- * @return Error return value. If a frame does not contain any image data,
- * GIF_OK is returned and gif->current_error is set to
- * GIF_FRAME_NO_DISPLAY
+ * \return Error return value.
* - GIF_FRAME_DATA_ERROR for GIF frame data error
* - GIF_INSUFFICIENT_FRAME_DATA for insufficient data to complete the frame
* - GIF_DATA_ERROR for GIF error (invalid frame header)