mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-12 05:49:19 +03:00
[project @ 2004-11-09 21:27:59 by rjw]
Fix for GIF dirty frame clearance bug. svn path=/import/netsurf/; revision=1353
This commit is contained in:
parent
dde5f820ea
commit
4d520be08c
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user