--- dillo/src/gif.c	Sat Dec  9 12:43:48 2000
+++ dillo.new/src/gif.c	Sun Dec 10 01:57:41 2000
@@ -70,6 +70,7 @@
 #include "web.h"
 #include "cache.h"
 #include "dicache.h"
+#include "prefs.h"
 
 #define INTERLACE      0x40
 #define LOCALCOLORMAP  0x80
@@ -159,7 +160,9 @@ Dw *a_Gif_image(const char *Type, void *
    DICacheEntry *DicEntry;
 
    if ( !web->Image )
-      web->Image = a_Image_new(0, 0, "gif", DW_PAINT_DEFAULT_BGND);
+      web->Image = a_Image_new(0, 0, "gif", prefs.bg_color);
+      /* todo: get the backgound color from the parent 
+       * of the image widget -- Livio.                 */
 
    DicEntry = a_Dicache_get_entry(web->url);
    if ( !DicEntry ) {
@@ -829,14 +832,11 @@ static size_t Gif_get_descriptor(DilloGi
       Size += mysize;           /* Size of the color table that follows */
       gif->Background = buf[5];
    }
-   gif->Width = LM_to_uint(buf[0], buf[1]);
-   gif->Height = LM_to_uint(buf[2], buf[3]);
+   /*   gif->Width = LM_to_uint(buf[0], buf[1]);
+	gif->Height = LM_to_uint(buf[2], buf[3]); */
    gif->ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
    /*   gif->AspectRatio     = buf[6]; */
 
-   gif->linebuf = g_malloc(gif->Width);
-   a_Dicache_set_parms(gif->DicEntryKey, gif->Image,
-                       gif->Width, gif->Height, DILLO_IMG_TYPE_INDEXED);
    return Size;
 }
 
@@ -856,6 +856,14 @@ static size_t Gif_do_img_desc(DilloGif *
 
    if (bsize < 10)
       return 0;
+
+   gif->Width   = LM_to_uint(buf[4], buf[5]);
+   gif->Height  = LM_to_uint(buf[6], buf[7]);
+   gif->linebuf = g_malloc(gif->Width);
+
+   a_Dicache_set_parms(gif->DicEntryKey, gif->Image, 
+                       gif->Width, gif->Height, DILLO_IMG_TYPE_INDEXED);
+
    Flags = buf[8];
 
    gif->Flags |= Flags & INTERLACE;
