From 5869210788371d84bc1d5a6996e103779aa7c541 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Wed, 3 Nov 1999 22:19:42 +0000 Subject: [PATCH] set the transparency to the right val. 1999-11-03 Jonathan Blandford * src/io-gif.c (gif_get_lzw): set the transparency to the right val. --- gdk-pixbuf/ChangeLog | 1 + gdk-pixbuf/io-gif.c | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 58df066f56..599fd77b10 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -11,6 +11,7 @@ * src/io-gif.c (image_load_increment): now handle arbitrary buffer sizes. + (gif_get_lzw): set the transparency to the right val. 1999-11-03 Federico Mena Quintero diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 8b278d8e59..80a6c97189 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -153,8 +153,10 @@ struct _GifContext static int GetDataBlock (GifContext *, unsigned char *); - +#ifdef IO_GIFDEBUG static int count = 0; +#endif + /* Returns TRUE if Read is OK, * FALSE if more memory is needed. */ static int @@ -165,8 +167,8 @@ ReadOK (GifContext *context, guchar *buffer, size_t len) gint i; #endif if (context->file) { - count += len; #ifdef IO_GIFDEBUG + count += len; g_print ("Fsize :%d\tcount :%d\t", len, count); #endif retval = (fread(buffer, len, 1, context->file) != 0); @@ -183,8 +185,10 @@ ReadOK (GifContext *context, guchar *buffer, size_t len) // g_print ("\tlooking for %d bytes. size == %d, ptr == %d\n", len, context->size, context->ptr); #endif if ((context->size - context->ptr) >= len) { +#ifdef IO_GIFDEBUG count += len; - memmove (buffer, context->buf + context->ptr, len); +#endif + memcpy (buffer, context->buf + context->ptr, len); context->ptr += len; context->amount_needed = 0; #ifdef IO_GIFDEBUG @@ -329,10 +333,11 @@ gif_get_extension (GifContext *context) if (context->pixbuf == NULL) { /* I only want to set the transparency if I haven't * created the pixbuf yet. */ - if ((context->block_buf[0] & 0x1) != 0) + if ((context->block_buf[0] & 0x1) != 0) { context->gif89.transparent = context->block_buf[3]; - else - context->gif89.transparent = -1; + } else { + context->gif89.transparent = FALSE; + } } /* Now we've successfully loaded this one, we continue on our way */ @@ -660,7 +665,7 @@ gif_get_lzw (GifContext *context) *temp = context->color_map [0][(guchar) v]; *(temp+1) = context->color_map [1][(guchar) v]; *(temp+2) = context->color_map [2][(guchar) v]; - *(temp+3) = (guchar) ((v == context->gif89.transparent) ? 0 : 65535); + *(temp+3) = (guchar) ((v == context->gif89.transparent) ? 0 : -1); } else { temp = dest + context->draw_ypos * gdk_pixbuf_get_rowstride (context->pixbuf) + context->draw_xpos * 3; *temp = context->color_map [0][(guchar) v]; @@ -962,7 +967,9 @@ image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data) { GifContext *context; +#ifdef IO_GIFDEBUG count = 0; +#endif context = g_new (GifContext, 1); context->func = func; context->user_data = user_data;