comparison src/image.c @ 84351:162e36293ef2

(gif_load): Fix bug: Handle nonexistent colormap.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Thu, 06 Sep 2007 20:23:57 +0000
parents 9109a293afb7
children 589ba73a64a6
comparison
equal deleted inserted replaced
84350:13fc3289f099 84351:162e36293ef2
7884 if (!gif_color_map) 7884 if (!gif_color_map)
7885 gif_color_map = gif->SColorMap; 7885 gif_color_map = gif->SColorMap;
7886 init_color_table (); 7886 init_color_table ();
7887 bzero (pixel_colors, sizeof pixel_colors); 7887 bzero (pixel_colors, sizeof pixel_colors);
7888 7888
7889 for (i = 0; i < gif_color_map->ColorCount; ++i) 7889 if (gif_color_map)
7890 { 7890 for (i = 0; i < gif_color_map->ColorCount; ++i)
7891 int r = gif_color_map->Colors[i].Red << 8; 7891 {
7892 int g = gif_color_map->Colors[i].Green << 8; 7892 int r = gif_color_map->Colors[i].Red << 8;
7893 int b = gif_color_map->Colors[i].Blue << 8; 7893 int g = gif_color_map->Colors[i].Green << 8;
7894 pixel_colors[i] = lookup_rgb_color (f, r, g, b); 7894 int b = gif_color_map->Colors[i].Blue << 8;
7895 } 7895 pixel_colors[i] = lookup_rgb_color (f, r, g, b);
7896 }
7896 7897
7897 #ifdef COLOR_TABLE_SUPPORT 7898 #ifdef COLOR_TABLE_SUPPORT
7898 img->colors = colors_in_color_table (&img->ncolors); 7899 img->colors = colors_in_color_table (&img->ncolors);
7899 free_color_table (); 7900 free_color_table ();
7900 #endif /* COLOR_TABLE_SUPPORT */ 7901 #endif /* COLOR_TABLE_SUPPORT */