]> mj.ucw.cz Git - libucw.git/commitdiff
disabling GIF transparency... I probably do not understand GIF
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 31 Jul 2006 11:13:08 +0000 (13:13 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 31 Jul 2006 11:13:08 +0000 (13:13 +0200)
specification, because SBackGroundColor == 0 insted of 255
(real transparent color index) in one tested GIF

images/io-libungif.c
images/io-main.c

index a35b6d8323470abe27fb86c15be70d003b9657cb..a3bfc397eea43daf1c859e6dcbb676e765b300cc 100644 (file)
@@ -45,6 +45,7 @@ libungif_read_header(struct image_io *io)
       return 0;
     }
 
+  DBG("executing DGifSlurp()");
   if (unlikely(DGifSlurp(gif) != GIF_OK))
     {
       image_thread_err(io->thread, IMAGE_ERR_READ_FAILED, "Gif read failed.");
@@ -52,6 +53,7 @@ libungif_read_header(struct image_io *io)
       return 0;
     }
 
+  DBG("ImageCount=%d ColorResolution=%d SBackGroundColor=%d SColorMap=%p", gif->ImageCount, gif->SColorResolution, gif->SBackGroundColor, gif->SColorMap);
   if (unlikely(!gif->ImageCount))
     {
       image_thread_err(io->thread, IMAGE_ERR_READ_FAILED, "There are no images in gif file.");
@@ -84,12 +86,15 @@ libungif_read_header(struct image_io *io)
       return 0;
     }
   io->flags = COLOR_SPACE_RGB | IMAGE_IO_HAS_PALETTE;
-  if ((uns)gif->SBackGroundColor < (uns)color_map->ColorCount)
+  /* FIXME transparent GIFs disabled */
+#if 0
+  if (gif->SColorMap && !image->ImageDesc.ColorMap && (uns)gif->SBackGroundColor < (uns)color_map->ColorCount)
     {
       io->flags |= IMAGE_ALPHA | IMAGE_IO_HAS_BACKGROUND;
       GifColorType *background = color_map->Colors + gif->SBackGroundColor;
       color_make_rgb(&io->background_color, background->Red, background->Green, background->Blue);
     }
+#endif
 
   /* Success */
   io->read_cancel = libungif_read_cancel;
@@ -116,7 +121,12 @@ libungif_read_data(struct image_io *io)
   byte *pixels = (byte *)image->RasterBits;
   ColorMapObject *color_map = image->ImageDesc.ColorMap ? : gif->SColorMap;
   GifColorType *palette = color_map->Colors;
-  uns background = gif->SBackGroundColor;
+  uns background = (
+  /* FIXME: transparent GIFs disabled */
+#if 1
+    0 &&
+#endif
+    gif->SColorMap && !image->ImageDesc.ColorMap) ? gif->SBackGroundColor : 256;
   byte *img_end = rdi.image->pixels + rdi.image->image_size;
 
   /* Handle deinterlacing */
index 9442c7e0170084a7cb106d4b67352e65b00f2c92..15e76fbb57bef15337d9d995105c82f363164b20 100644 (file)
@@ -7,7 +7,7 @@
  *     of the GNU Lesser General Public License.
  */
 
-#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
 
 #include "lib/lib.h"
 #include "images/images.h"