summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Fox <dyntryx@gmail.com>2008-06-22 07:54:03 +0000
committerSean Fox <dyntryx@gmail.com>2008-06-22 07:54:03 +0000
commit3f57700ce0383cf29528b1d9a1c8db6fcabe8f21 (patch)
tree814185d24ad35eebcd6f0f029621fa7b1280cc2e
parente1a2b0ad24d1d1284bd73c7f5afd43819dcd0cab (diff)
downloadlibnsgif-3f57700ce0383cf29528b1d9a1c8db6fcabe8f21.tar.gz
libnsgif-3f57700ce0383cf29528b1d9a1c8db6fcabe8f21.tar.bz2
Made a constant for the GIF trailer (0x3b) so it's more obvious what that byte does
svn path=/branches/dynis/libnsgif/; revision=4416
-rw-r--r--libnsgif.c9
-rw-r--r--libnsgif.h6
2 files changed, 10 insertions, 5 deletions
diff --git a/libnsgif.c b/libnsgif.c
index d4e5200..6202e39 100644
--- a/libnsgif.c
+++ b/libnsgif.c
@@ -102,7 +102,6 @@ static bool get_done;
*/
static bool clear_image = false;
-
/* Initialises any workspace held by the animation and attempts to decode
any information that hasn't already been decoded.
If an error occurs, all previously decoded frames are retained.
@@ -359,7 +358,7 @@ int gif_initialise_frame(struct gif_animation *gif, gif_bitmap_callback_vt *bitm
/* Check we have enough data for at least the header, or if we've finished
*/
- if ((gif_bytes > 0) && (gif_data[0] == 0x3b)) return 1;
+ if ((gif_bytes > 0) && (gif_data[0] == GIF_TRAILER)) return 1;
if (gif_bytes < 11) return -1;
/* We could theoretically get some junk data that gives us millions of frames, so
@@ -536,7 +535,7 @@ int gif_initialise_frame(struct gif_animation *gif, gif_bitmap_callback_vt *bitm
/* Check for end of data
*/
- more_images &= !((gif_bytes < 1) || (gif_data[0] == 0x3b));
+ more_images &= !((gif_bytes < 1) || (gif_data[0] == GIF_TRAILER));
}
/* Check if we've finished
@@ -546,7 +545,7 @@ int gif_initialise_frame(struct gif_animation *gif, gif_bitmap_callback_vt *bitm
else {
gif->buffer_position = gif_data - gif->gif_data;
gif->frame_count = frame + 1;
- if (gif_data[0] == 0x3b) return 1;
+ if (gif_data[0] == GIF_TRAILER) return 1;
}
return 0;
}
@@ -836,7 +835,7 @@ gif_decode_frame_exit:
/* Check for end of data
*/
gif_bytes = gif->buffer_size - gif->buffer_position;
- more_images &= !((gif_bytes < 1) || (gif_data[0] == 0x3b));
+ more_images &= !((gif_bytes < 1) || (gif_data[0] == GIF_TRAILER));
gif->buffer_position++;
}
diff --git a/libnsgif.h b/libnsgif.h
index f05df71..c93eb03 100644
--- a/libnsgif.h
+++ b/libnsgif.h
@@ -33,6 +33,7 @@
#define GIF_INSUFFICIENT_DATA -3
#define GIF_DATA_ERROR -4
#define GIF_INSUFFICIENT_MEMORY -5
+#define GIF_FRAME_NO_DISPLAY -6
/* Maximum colour table size
*/
@@ -42,11 +43,16 @@
*/
#define GIF_MAX_LZW 12
+/* 1-byte GIF Trailer "[indicates] the end of the GIF Data Stream" (fixed value: 0x3b)
+*/
+#define GIF_TRAILER 0x3b
+
/* The GIF frame data
*/
typedef struct gif_frame {
unsigned int frame_pointer; /**< offset (in bytes) to the GIF frame data */
unsigned int frame_delay; /**< delay (in cs) before animating the frame */
+ bool display; /**< whether the frame should be displayed/animated */
bool virgin; /**< whether the frame has previously been used */
bool opaque; /**< whether the frame is totally opaque */
bool redraw_required; /**< whether a forcable screen redraw is required */