]> git.imager.perl.org - imager.git/commitdiff
fix some range checking for the fountain fill segment type
authorTony Cook <tony@develop=help.com>
Sat, 27 Oct 2001 07:30:10 +0000 (07:30 +0000)
committerTony Cook <tony@develop=help.com>
Sat, 27 Oct 2001 07:30:10 +0000 (07:30 +0000)
Changes
filters.c
t/t61filters.t

diff --git a/Changes b/Changes
index afdecd8d0288b2d60c4d7697c696a03ae9fd0138..17ba8879f090943e7931da3fc150d41b16d9a6cd 100644 (file)
--- a/Changes
+++ b/Changes
@@ -534,6 +534,7 @@ Revision history for Perl extension Imager.
           intensity scaling.
         - constant edge extension for scaling operations
         - better error checking of automatic fill conversions
+        - fix some range checking for the fountain fill segment type
 
 
 =================================================================
index f06e31de4aa68af6ac279a82c93397141581e9e1..8f89b64650fe65a9fc8f57e5902178888cbe7e17 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1529,8 +1529,8 @@ fount_init_state(struct fount_state *state, double xa, double ya,
     i_fountain_seg *seg = my_segs + i;
 
     *seg = segs[i];
-    if (seg->type < 0 || type >= i_ft_end)
-      seg->type = i_ft_linear;
+    if (seg->type < 0 || seg->type >= i_fst_end)
+      seg->type = i_fst_linear;
     if (seg->color < 0 || seg->color >= i_fc_end)
       seg->color = i_fc_direct;
     if (seg->color == i_fc_hue_up || seg->color == i_fc_hue_down) {
index ad06f7a6d5c06b922a3346160cec58c748c53a77..8708f9bf21308b969915b22a5d44e4087b65b453 100644 (file)
@@ -9,7 +9,7 @@ $imbase->open(file=>'testout/t104.ppm') or die;
 my $im_other = Imager->new(xsize=>150, ysize=>150);
 $im_other->box(xmin=>30, ymin=>60, xmax=>120, ymax=>90, filled=>1);
 
-print "1..41\n";
+print "1..43\n";
 
 test($imbase, 1, {type=>'autolevels'}, 'testout/t61_autolev.ppm');
 
@@ -84,6 +84,13 @@ test($imbase, 38, { type=>'unsharpmask', stddev=>2.0 },
 test($imbase, 40, {type=>'conv', coef=>[ -1, 3, -1, ], },
      'testout/t61_conv_sharp.ppm');
 
+# Regression test: the checking of the segment type was incorrect
+# (the comparison was checking the wrong variable against the wrong value)
+my $f4 = [ [ 0, 0.5, 1, NC(0,0,0), NC(255,255,255), 5, 0 ] ];
+test($imbase, 42, {type=>'fountain',  xa=>75, ya=>75, xb=>90, yb=>15,
+                    segments=>$f4, super_sample=>'grid',
+                    ftype=>'linear', combine=>'color' },
+     'testout/t61_regress_fount.ppm');
 
 sub test {
   my ($in, $num, $params, $out) = @_;