]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 25 Nov 2012 23:19:48 +0000 (23:19 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 25 Nov 2012 23:19:48 +0000 (23:19 +0000)
coders/label.c

index c4f6860a4f4eeb389ef6b8d93fc4458d5b16abb6..e5548096223778afbebe42dfda4bf721b7beca85 100644 (file)
@@ -150,7 +150,8 @@ static Image *ReadLABELImage(const ImageInfo *image_info,
         (void) status;
         width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
         height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
-        if ((width > image->columns) && (height > image->rows))
+        if (((image->columns != 0) && (width > image->columns)) ||
+            ((image->rows != 0) && (height > image->rows)))
           break;
         draw_info->pointsize*=2.0;
       }
@@ -166,12 +167,13 @@ static Image *ReadLABELImage(const ImageInfo *image_info,
         status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception);
         width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
         height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
-        if ((width <= image->columns) && (height <= image->rows))
+        if (((image->columns != 0) && (width <= image->columns)) ||
+            ((image->rows != 0) && (height <= image->rows)))
           low=draw_info->pointsize+1.0;
         else
           high=draw_info->pointsize-1.0;
       }
-      for (draw_info->pointsize=(low+high)/2.0; (high-low) > 1.0; )
+      for (draw_info->pointsize=(low+high)/2.0; ; )
       {
         (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",
           -metrics.bounds.x1,metrics.ascent);
@@ -180,7 +182,8 @@ static Image *ReadLABELImage(const ImageInfo *image_info,
         status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception);
         width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
         height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
-        if ((width <= image->columns) && (height <= image->rows))
+        if (((image->columns != 0) && (width <= image->columns)) ||
+            ((image->rows != 0) && (height <= image->rows)))
           break;
         draw_info->pointsize--;
       }