From: cristy Date: Thu, 18 Mar 2010 00:42:45 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~9783 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=679e696e29d443f68580c033eca61ff1a7f9bc71;p=imagemagick --- diff --git a/magick/geometry.c b/magick/geometry.c index d51c1a3ab..eefadbb67 100644 --- a/magick/geometry.c +++ b/magick/geometry.c @@ -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) { diff --git a/magick/resize.c b/magick/resize.c index 77128a899..e59f86778 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -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,