]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 18 Mar 2010 00:42:45 +0000 (00:42 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 18 Mar 2010 00:42:45 +0000 (00:42 +0000)
magick/geometry.c
magick/resize.c

index d51c1a3ab94df7c09995e60ff7f365b2c7c388ba..eefadbb675dde42759620b9914d23157716a4b5a 100644 (file)
@@ -1121,10 +1121,10 @@ MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,long *x,
       scale.y=geometry_info.sigma;
       if ((flags & SigmaValue) == 0)
         scale.y=scale.x;
-      *width=(unsigned long) floor(scale.x*former_width/100.0-0.5);
+      *width=(unsigned long) floor(scale.x*former_width/100.0+0.5);
       if (*width == 0)
         *width=1;
-      *height=(unsigned long) floor(scale.y*former_height/100.0-0.5);
+      *height=(unsigned long) floor(scale.y*former_height/100.0+0.5);
       if (*height == 0)
         *height=1;
       former_width=(*width);
@@ -1179,10 +1179,8 @@ MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,long *x,
                 scale_factor=(MagickRealType) *height/(MagickRealType)
                   former_width;
             }
-      *width=MagickMax((unsigned long) floor(scale_factor*former_width+0.5),
-        1UL);
-      *height=MagickMax((unsigned long) floor(scale_factor*former_height+0.5),
-        1UL);
+      *width=MagickMax((unsigned long) floor(scale_factor*former_width+0.5),1UL);
+      *height=MagickMax((unsigned long) floor(scale_factor*former_height+0.5),1UL);
     }
   if ((flags & GreaterValue) != 0)
     {
index 77128a899a3523efe5adbd39e7bc00946fcf197b..e59f8677878a708c1f657ae1cdda89bd9395aadf 100644 (file)
@@ -208,7 +208,7 @@ static MagickRealType CubicBC(const MagickRealType x,
     return(resize_filter->cubic[0]+x*(resize_filter->cubic[1]+x*
       (resize_filter->cubic[2]+x*resize_filter->cubic[3])));
   if (x < 2.0)
-    return(resize_filter->cubic[4] +x*(resize_filter->cubic[5]+x*
+    return(resize_filter->cubic[4]+x*(resize_filter->cubic[5]+x*
       (resize_filter->cubic[6] +x*resize_filter->cubic[7])));
   return(0.0);
 }
@@ -1811,8 +1811,8 @@ static MagickBooleanType HorizontalFilter(const ResizeFilter *resize_filter,
     if (status == MagickFalse)
       continue;
     center=(MagickRealType) (x+0.5)/x_factor;
-    start=(long) ceil(MagickMax(center-support-MagickEpsilon,0.0)-0.5);
-    stop=(long) floor(MagickMin(center+support,(double) image->columns)+0.5);
+    start=(long) MagickMax(center-support+0.5,0.0);
+    stop=(long) MagickMin(center+support+0.5,(double) image->columns);
     density=0.0;
     contribution=contributions[GetOpenMPThreadId()];
     for (n=0; n < (stop-start); n++)
@@ -2052,9 +2052,9 @@ static MagickBooleanType VerticalFilter(const ResizeFilter *resize_filter,
 
     if (status == MagickFalse)
       continue;
-    center=(MagickRealType) (y-0.5)/y_factor;
-    start=(long) ceil(MagickMax(center-support-MagickEpsilon,0.0)-0.5);
-    stop=(long) floor(MagickMin(center+support,(double) image->rows)+0.5);
+    center=(MagickRealType) (y+0.5)/y_factor;
+    start=(long) MagickMax(center-support+0.5,0.0);
+    stop=(long) MagickMin(center+support+0.5,(double) image->rows);
     density=0.0;
     contribution=contributions[GetOpenMPThreadId()];
     for (n=0; n < (stop-start); n++)
@@ -2417,8 +2417,7 @@ MagickExport Image *SampleImage(const Image *image,const unsigned long columns,
 
     if (status == MagickFalse)
       continue;
-    y_offset=(long) ceil(((MagickRealType) y-0.5)*image->rows/
-      sample_image->rows);
+    y_offset=(long) (((MagickRealType) y+0.5)*image->rows/sample_image->rows);
     p=GetCacheViewVirtualPixels(image_view,0,y_offset,image->columns,1,
       exception);
     q=QueueCacheViewAuthenticPixels(sample_view,0,y,sample_image->columns,1,