diff options
-rw-r--r-- | gdk-pixbuf/io-gif.c | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 2a7afd049..b08a00bd6 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -88,16 +88,6 @@ enum { GIF_DONE }; - -typedef struct _Gif89 Gif89; -struct _Gif89 -{ - int transparent; - int delay_time; - int input_flag; - int disposal; -}; - typedef struct _GifContext GifContext; struct _GifContext { @@ -109,17 +99,16 @@ struct _GifContext gint global_colormap_size; unsigned int global_bit_pixel; - unsigned int global_color_resolution; - unsigned int background_index; CMap frame_color_map; gint frame_colormap_size; unsigned int frame_bit_pixel; - unsigned int aspect_ratio; GdkPixbufGifAnim *animation; GdkPixbufFrame *frame; - Gif89 gif89; + int transparent_index; + int delay_time; + int disposal; /* stuff per frame. */ int frame_len; @@ -347,14 +336,13 @@ gif_get_extension (GifContext *context) /* I only want to set the transparency if I haven't * created the frame yet. */ - context->gif89.disposal = (context->block_buf[0] >> 2) & 0x7; - context->gif89.input_flag = (context->block_buf[0] >> 1) & 0x1; - context->gif89.delay_time = LM_to_uint (context->block_buf[1], context->block_buf[2]); + context->disposal = (context->block_buf[0] >> 2) & 0x7; + context->delay_time = LM_to_uint (context->block_buf[1], context->block_buf[2]); if ((context->block_buf[0] & 0x1) != 0) { - context->gif89.transparent = context->block_buf[3]; + context->transparent_index = context->block_buf[3]; } else { - context->gif89.transparent = -1; + context->transparent_index = -1; } } @@ -461,10 +449,10 @@ gif_get_lzw (GifContext *context) context->frame->color_map = context->animation->color_map; } - context->frame->transparent_index = context->gif89.transparent; + context->frame->transparent_index = context->transparent_index; /* GIF delay is in hundredths, we want thousandths */ - context->frame->delay_time = context->gif89.delay_time * 10; + context->frame->delay_time = context->delay_time * 10; /* GIFs with delay time 0 are mostly broken, but they * just want a default, "not that fast" delay. @@ -481,7 +469,7 @@ gif_get_lzw (GifContext *context) context->frame->elapsed = context->animation->total_time; context->animation->total_time += context->frame->delay_time; - switch (context->gif89.disposal) { + switch (context->disposal) { case 0: case 1: context->frame->action = GDK_PIXBUF_FRAME_RETAIN; @@ -622,10 +610,7 @@ gif_init (GifContext *context) * last 3: size of colormap */ context->global_bit_pixel = 2 << (buf[4] & 0x07); - context->global_color_resolution = (((buf[4] & 0x70) >> 3) + 1); context->has_global_cmap = (buf[4] & 0x80) != 0; - context->background_index = buf[5]; - context->aspect_ratio = buf[6]; context->animation->width = context->width; context->animation->height = context->height; @@ -650,8 +635,8 @@ gif_init (GifContext *context) } #ifdef DUMP_IMAGE_DETAILS - g_print (">Image width: %d height: %d global_cmap: %d background: %d\n", - context->width, context->height, context->has_global_cmap, context->background_index); + g_print (">Image width: %d height: %d global_cmap: %d\n", + context->width, context->height, context->has_global_cmap); #endif return 0; @@ -679,11 +664,11 @@ gif_get_frame_info (GifContext *context) context->y_offset = LM_to_uint (buf[2], buf[3]); if (context->animation->frames == NULL && - context->gif89.disposal == 3) { + context->disposal == 3) { /* First frame can't have "revert to previous" as its * dispose mode. Silently use "retain" instead. */ - context->gif89.disposal = 0; + context->disposal = 0; } context->frame_interlace = BitSet (buf[8], INTERLACE); @@ -691,7 +676,7 @@ gif_get_frame_info (GifContext *context) #ifdef DUMP_IMAGE_DETAILS g_print (">width: %d height: %d xoffset: %d yoffset: %d disposal: %d delay: %d transparent: %d interlace: %d\n", context->frame_len, context->frame_height, context->x_offset, context->y_offset, - context->gif89.disposal, context->gif89.delay_time, context->gif89.transparent, context->frame_interlace); + context->disposal, context->delay_time, context->transparent_index, context->frame_interlace); #endif context->frame_colormap_size = 0; @@ -857,10 +842,9 @@ new_context (GdkPixbufModuleSizeFunc size_func, context->buf = NULL; context->amount_needed = 13; context->buf = g_new (guchar, context->amount_needed); - context->gif89.transparent = -1; - context->gif89.delay_time = -1; - context->gif89.input_flag = -1; - context->gif89.disposal = -1; + context->transparent_index = -1; + context->delay_time = -1; + context->disposal = -1; context->animation->loop = 1; context->in_loop_extension = FALSE; |