]> git.imager.perl.org - imager.git/commitdiff
fixed issue reported in ticket 1748, and added smoke tests that should
authorTony Cook <tony@develop=help.com>
Tue, 5 Nov 2002 00:11:23 +0000 (00:11 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 5 Nov 2002 00:11:23 +0000 (00:11 +0000)
have been there to detect it in the first place ;)
updated t37w32font.t to allow for i_draw to i_line rename
removed non-portable call to rint()

Changes
draw.c
lib/Imager/Font/Win32.pm
t/t37w32font.t

diff --git a/Changes b/Changes
index 540fba7b53de45c411c2999024a82dff5fab20df..317683a22b8b6a2a678c8f398b72bdfd13b286d2 100644 (file)
--- a/Changes
+++ b/Changes
@@ -671,13 +671,19 @@ Revision history for Perl extension Imager.
           specific to Imager::Font::Type1
         - mc_web_map was storing colors with an alpha of 0
         - update the URLs for libpng and zlib
-                               - Fixed empty string handling for tt font driver.
-                               - Fixed tiff handling of images all contained in a 
-                                       single strip (rowsperstrip = -1) and added a hack
-                                       for images missing the rowsperstrip tag.
-                               - Fixed default parameters for crop()
-                               - Added Preliminary specialized scaling code.
-                               - Added image type detection.
+        - Fixed empty string handling for tt font driver.
+        - Fixed tiff handling of images all contained in a 
+          single strip (rowsperstrip = -1) and added a hack
+          for images missing the rowsperstrip tag.
+        - Fixed default parameters for crop()
+        - Added Preliminary specialized scaling code.
+        - Added image type detection.
+        - added smoke test for win32 font bounding_box() method, and
+          fixed the problem reported in ticket #1748.
+        - update t37w32font.t to use i_line() instead of i_draw()
+        - replaced non-portable call to rint() with (int)(dy+0.5) (so we
+          can build on Win32)
+
 =================================================================
 
         For latest versions check the Imager-devel pages:
diff --git a/draw.c b/draw.c
index 6f98fe0c0ef2f1ab5aa5dbaeef2ba8ce909f1c8b..8f1a2090a069547126b9baac676d403edabb9293 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -537,7 +537,7 @@ i_line_dda(i_img *im, int x1, int y1, int x2, int y2, i_color *val) {
   
   for(x=x1; x<=x2; x++) {
     dy = y1+ (x-x1)/(float)(x2-x1)*(y2-y1);
-    i_ppix(im, x, rint(dy), val);
+    i_ppix(im, x, (int)(dy+0.5), val);
   }
 }
 
index cd4b94e4f8f44f6bb0b57f4551a669645d78395d..ca1818f1aaadfda8293c13f6d7fb8013c0939ba7 100644 (file)
@@ -15,7 +15,7 @@ sub new {
 sub _bounding_box {
   my ($self, %opts) = @_;
   
-  my @bbox = i_wf_bbox($self->{face}, $opts{size}, $opts{string});
+  my @bbox = Imager::i_wf_bbox($self->{face}, $opts{size}, $opts{string});
 }
 
 sub _draw {
index a4bf0aab16f712bd5053273f73664a25ac2b53a1..e0c61b7e5b458bb598d46bdec20dee81e9285eea 100644 (file)
@@ -1,5 +1,5 @@
 #!perl -w
-BEGIN { $| = 1; print "1..4\n"; }
+BEGIN { $| = 1; print "1..5\n"; }
 END {print "not ok 1\n" unless $loaded;}
 use Imager qw(:all);
 $loaded = 1;
@@ -29,7 +29,7 @@ $overlay=Imager::ImgRaw::new(200,70,3);
 print "#bbox: ($bbox[0], $bbox[1]) - ($bbox[2], $bbox[3])\n";
 
 Imager::i_wf_cp($fontname,$overlay,5,50,1,50.0,'XMCLH',1,1);
-i_draw($overlay,0,50,100,50,$bgcolor);
+i_line($overlay,0,50,100,50,$bgcolor, 1);
 
 open(FH,">testout/t37w32font.ppm") || die "cannot open testout/t37w32font.ppm\n";
 binmode(FH);
@@ -43,7 +43,7 @@ $bgcolor=i_color_set($bgcolor,200,200,200,0);
 $backgr=Imager::ImgRaw::new(500,300,3);
 
 Imager::i_wf_text($fontname,$backgr,100,100,$bgcolor,100,'MAW.',1, 1);
-i_draw($backgr,0, 100, 499, 100, NC(0, 0, 255));
+i_line($backgr,0, 100, 499, 100, NC(0, 0, 255), 1);
 
 open(FH,">testout/t37w32font2.ppm") || die "cannot open testout/t37w32font2.ppm\n";
 binmode(FH);
@@ -59,3 +59,10 @@ $img->string('x'=>30, 'y'=>30, string=>"Imager", color=>NC(255, 0, 0),
             font=>$font);
 $img->write(file=>'testout/t37_oo.ppm') or print "not ";
 print "ok 4 # ",$img->errstr||'',"\n";
+my @bbox2 = $font->bounding_box(string=>'Imager');
+if (@bbox2 == 6) {
+  print "ok 5 # @bbox2\n";
+}
+else {
+  print "not ok 5\n";
+}