]> git.imager.perl.org - imager.git/commitdiff
- i_box_cfill() went into an infinite loop on fountain fills
authorTony Cook <tony@develop=help.com>
Sat, 30 Mar 2002 13:59:13 +0000 (13:59 +0000)
committerTony Cook <tony@develop=help.com>
Sat, 30 Mar 2002 13:59:13 +0000 (13:59 +0000)
          or fills on images with more than 8-bits/sample

Changes
draw.c
t/t20fill.t

diff --git a/Changes b/Changes
index 30775a28f09fcfd3c27b5926b7ddab518d43a0ff..77e8ad46586e92d8c74c24de33e4124c7d7dc4a3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -617,6 +617,8 @@ Revision history for Perl extension Imager.
         - handle the presence of the default broken giflib better,
           by giving them some more prose about the problem, and skipping
           all but the first test that fails with the broken giflib
+        - i_box_cfill() went into an infinite loop on fountain fills
+          or fills on images with more than 8-bits/sample
 
 =================================================================
 
diff --git a/draw.c b/draw.c
index 68ada4f5c9df4a12c6845efc25286da4ea172cc7..882c9b3a190aadb30f28609d1be3b04277d267e0 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -413,6 +413,7 @@ i_box_cfill(i_img *im,int x1,int y1,int x2,int y2,i_fill_t *fill) {
         (fill->fill_with_fcolor)(fill, x1, y1, x2-x1, im->channels, line);
       }
       i_plinf(im, x1, x2, y1, line);
+      ++y1;
     }
     myfree(line);
     if (work)
index 39c6edf220ae5e78b9a9e2f3f04b3f5a4da522bf..45ac7665719440bc6508ff3de00516f0a3ee5b5a 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 
-print "1..39\n";
+print "1..40\n";
 
 use Imager ':handy';
 use Imager::Fill;
@@ -240,6 +240,22 @@ ok($testnum++,
    $oocopy->errstr =~ /Unknown hatch type/,
    "error message for automatic fill conversion");
 
+# previous box fills to float images, or using the fountain fill
+# got into a loop here
+{
+  local $SIG{ALRM} = sub { die; };
+
+  eval {
+    alarm(2);
+    ok($testnum,
+       $ooim->box(xmin=>20, ymin=>20, xmax=>80, ymax=>40,
+                  fill=>{ fountain=>'linear', xa=>20, ya=>20, xb=>80, 
+                          yb=>20 }), "linear box fill");
+    ++$testnum;
+  };
+  $@ and ok($testnum++, 0, "linear box fill alarmed");
+}
+
 sub ok ($$$) {
   my ($num, $test, $desc) = @_;