GifRowType GifRow;
int got_gce = 0;
- int trans_index; /* transparent index if we see a GCE */
- int gif_delay; /* delay from a GCE */
- int user_input; /* user input flag from a GCE */
- int disposal; /* disposal method from a GCE */
+ int trans_index = 0; /* transparent index if we see a GCE */
+ int gif_delay = 0; /* delay from a GCE */
+ int user_input = 0; /* user input flag from a GCE */
+ int disposal = 0; /* disposal method from a GCE */
int got_ns_loop = 0;
- int ns_loop;
+ int ns_loop = 0;
char *comment = NULL; /* a comment */
i_img **results = NULL;
int result_alloc = 0;
else
trans_index = -1;
gif_delay = Extension[2] + 256 * Extension[3];
- user_input = (Extension[0] & 2) != 0;
- disposal = (Extension[0] >> 2) & 3;
+ user_input = (Extension[1] & 2) != 0;
+ disposal = (Extension[1] >> 2) & 7;
}
if (ExtCode == 0xFF && *Extension == 11) {
if (memcmp(Extension+1, "NETSCAPE2.0", 11) == 0) {
static undef_int
i_writegif_low(i_quantize *quant, GifFileType *gf, i_img **imgs, int count) {
- unsigned char *result;
+ unsigned char *result = NULL;
int color_bits;
ColorMapObject *map;
int scrw = 0, scrh = 0;
int imgn, orig_count, orig_size;
int posx, posy;
- int trans_index;
+ int trans_index = -1;
i_mempool mp;
int *localmaps;
int anylocal;
int glob_img_count;
i_color *orig_colors = quant->mc_colors;
i_color *glob_colors = NULL;
- int glob_color_count;
+ int glob_color_count = 0;
int glob_want_trans;
- int glob_paletted; /* the global map was made from the image palettes */
- int colors_paletted;
- int want_trans;
+ int glob_paletted = 0; /* the global map was made from the image palettes */
+ int colors_paletted = 0;
+ int want_trans = 0;
int interlace;
int gif_background;
#!perl -w
+
=pod
IF THIS TEST CRASHES
use strict;
$|=1;
use lib 't';
-use Test::More tests => 113;
+use Test::More tests => 125;
use Imager qw(:all);
BEGIN { require "t/testtools.pl"; }
use Carp 'confess';
$im = Imager->new(xsize=>2, ysize=>2);
ok(!$im->write(file=>"testout/nogif.gif"), "should fail to write gif");
is($im->errstr, 'format not supported', "check no gif message");
- skip("no gif support", 109);
+ skip("no gif support", 121);
}
open(FH,">testout/t105.gif") || die "Cannot open testout/t105.gif\n";
binmode(FH);
is($im[0]->tags(name => 'gif_delay'), 50, "first delay read back");
is($im[1]->tags(name => 'gif_delay'), 50, "second delay read back");
}
+ SKIP:
+ { # check graphic control extension and ns loop tags are read correctly
+ print "# check GCE and netscape loop extension tag values\n";
+ my @im = Imager->read_multi(file => 'testimg/screen3.gif');
+ is(@im, 2, "read 2 images from screen3.gif")
+ or skip("Could not load testimg/screen3.gif:".Imager->errstr, 11);
+ is($im[0]->tags(name => 'gif_delay'), 50, "0 - gif_delay");
+ is($im[0]->tags(name => 'gif_disposal'), 2, "0 - gif_disposal");
+ is($im[0]->tags(name => 'gif_trans_index'), undef, "0 - gif_trans_index");
+ is($im[0]->tags(name => 'gif_user_input'), 0, "0 - gif_user_input");
+ is($im[0]->tags(name => 'gif_loop'), 0, "0 - gif_loop");
+ is($im[1]->tags(name => 'gif_delay'), 50, "1 - gif_delay");
+ is($im[1]->tags(name => 'gif_disposal'), 2, "1 - gif_disposal");
+ is($im[1]->tags(name => 'gif_trans_index'), 7, "1 - gif_trans_index");
+ is($im[1]->tags(name => 'gif_trans_color'), 'color(255,255,255,0)',
+ "1 - gif_trans_index");
+ is($im[1]->tags(name => 'gif_user_input'), 0, "1 - gif_user_input");
+ is($im[1]->tags(name => 'gif_loop'), 0, "1 - gif_loop");
+ }
}
sub test_readgif_cb {