]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 1 Dec 2011 16:09:03 +0000 (16:09 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 1 Dec 2011 16:09:03 +0000 (16:09 +0000)
MagickCore/transform.c

index 0e10879b53bee7db3d95623b2fc2eba69cad26ad..bbdfb79b02b5d2f5e763038ada66203d66d5b871 100644 (file)
@@ -747,8 +747,14 @@ MagickExport Image *CropImageToTiles(const Image *image,
           width+=(geometry.x < 0 ? -1 : 1)*geometry.x;
           height+=(geometry.y < 0 ? -1 : 1)*geometry.y;
         }
-      delta.x=(double) (width+(geometry.width >> 1))/geometry.width;
-      delta.y=(double) (height+(geometry.height >> 1))/geometry.height;
+      if ((width % geometry.width) != 0)
+        delta.x=(double) (width+(geometry.width >> 1))/geometry.width;
+      else
+        delta.x=(double) width/geometry.width;
+      if ((height % geometry.height) != 0)
+        delta.y=(double) (height+(geometry.height >> 1))/geometry.height;
+      else
+        delta.y=(double) height/geometry.height;
       for (offset.y=0; offset.y < (double) height; )
       {
         if ((flags & AspectValue) == 0)