summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-11-09 21:27:59 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-11-09 21:27:59 +0000
commit4d520be08c0713e002d5622e9c362b35307dbe75 (patch)
treeb5b41d62850b3497e58cc6357ee1b33c1deeeae7
parentdde5f820ea08828a500a096f53302e369a7388c1 (diff)
downloadnetsurf-4d520be08c0713e002d5622e9c362b35307dbe75.tar.gz
netsurf-4d520be08c0713e002d5622e9c362b35307dbe75.tar.bz2
[project @ 2004-11-09 21:27:59 by rjw]
Fix for GIF dirty frame clearance bug. svn path=/import/netsurf/; revision=1353
-rw-r--r--image/gifread.c15
-rw-r--r--image/gifread.h4
2 files changed, 10 insertions, 9 deletions
diff --git a/image/gifread.c b/image/gifread.c
index 5fbfe83d4..77980ce25 100644
--- a/image/gifread.c
+++ b/image/gifread.c
@@ -134,7 +134,7 @@ int gif_initialise(struct gif_animation *gif) {
*/
gif->frame_count = 0;
gif->frame_count_partial = 0;
- gif->decoded_frame = 0xffffffff;
+ gif->decoded_frame = -1;
/* Check we are a GIF
*/
@@ -339,7 +339,7 @@ static int gif_initialise_sprite(struct gif_animation *gif, unsigned int width,
/* Invalidate our currently decoded image
*/
- gif->decoded_frame = 0xffffffff;
+ gif->decoded_frame = -1;
return 0;
}
@@ -354,7 +354,7 @@ static int gif_initialise_sprite(struct gif_animation *gif, unsigned int width,
1 for success (GIF terminator found)
*/
int gif_initialise_frame(struct gif_animation *gif) {
- unsigned int frame;
+ int frame;
gif_frame *temp_buf;
unsigned char *gif_data, *gif_end;
@@ -389,7 +389,7 @@ int gif_initialise_frame(struct gif_animation *gif) {
/* Get some memory to store our pointers in etc.
*/
- if (gif->frame_holders <= frame) {
+ if ((int)gif->frame_holders <= frame) {
/* Allocate more memory
*/
if ((temp_buf = (gif_frame *)realloc(gif->frames,
@@ -413,7 +413,7 @@ int gif_initialise_frame(struct gif_animation *gif) {
/* Invalidate any previous decoding we have of this frame
*/
- if (gif->decoded_frame == frame) gif->decoded_frame = 0xffffffff;
+ if (gif->decoded_frame == frame) gif->decoded_frame = -1;
/* We pretend to initialise the frames, but really we just skip over all
the data contained within. This is all basically a cut down version of
@@ -606,7 +606,7 @@ int gif_decode_frame(struct gif_animation *gif, unsigned int frame) {
/* Ensure we have a frame to decode
*/
if (frame > gif->frame_count_partial) return GIF_INSUFFICIENT_DATA;
- if ((!clear_image) && (frame == gif->decoded_frame)) return 0;
+ if ((!clear_image) && ((int)frame == gif->decoded_frame)) return 0;
/* If the previous frame was dirty, remove it
*/
@@ -635,7 +635,7 @@ int gif_decode_frame(struct gif_animation *gif, unsigned int frame) {
*/
frame_data = (unsigned int *)bitmap_get_buffer(gif->frame_image);
if (!clear_image) {
- if ((frame == 0) || (gif->decoded_frame == 0xffffffff)) {
+ if ((frame == 0) || (gif->decoded_frame == -1)) {
memset((char*)frame_data, 0x00, gif->width * gif->height * sizeof(int));
}
gif->decoded_frame = frame;
@@ -758,6 +758,7 @@ int gif_decode_frame(struct gif_animation *gif, unsigned int frame) {
*/
if ((background_action == 2) || (background_action == 3)) {
gif->dirty_frame = frame;
+ LOG(("Dirty frame %i", gif->dirty_frame));
}
/* Initialise the LZW decoding
diff --git a/image/gifread.h b/image/gifread.h
index 77e899b81..f5d88d481 100644
--- a/image/gifread.h
+++ b/image/gifread.h
@@ -51,7 +51,7 @@ typedef struct gif_animation {
unsigned int buffer_position; /**< current index into GIF data */
unsigned int buffer_size; /**< total number of bytes of GIF data available */
unsigned int frame_holders; /**< current number of frame holders */
- unsigned int decoded_frame; /**< current frame decoded to bitmap */
+ int decoded_frame; /**< current frame decoded to bitmap */
int loop_count; /**< number of times to loop animation */
gif_frame *frames; /**< decoded frames */
unsigned int width; /**< width of GIF (may increase during decoding) */
@@ -64,7 +64,7 @@ typedef struct gif_animation {
bool global_colours; /**< whether the GIF has a global colour table */
unsigned int *global_colour_table; /**< global colour table */
unsigned int *local_colour_table; /**< local colour table */
- unsigned int dirty_frame; /**< the current dirty frame, or -1 for none */
+ int dirty_frame; /**< the current dirty frame, or -1 for none */
struct bitmap *frame_image; /**< currently decoded image */
} gif_animation;