diff options
author | Cristy <mikayla-grace@urban-warrior.org> | 2020-12-25 11:15:13 -0500 |
---|---|---|
committer | Cristy <mikayla-grace@urban-warrior.org> | 2020-12-25 11:15:13 -0500 |
commit | 20ab450bb4353fea3121d2af4afc3cde6134d24f (patch) | |
tree | d88504f9850b8d35b55bf3218145bee8a3be0113 /MagickCore | |
parent | 705a60a54db97c9a56b3ae78796223e9468097a3 (diff) | |
download | ImageMagick-20ab450bb4353fea3121d2af4afc3cde6134d24f.tar.gz |
case double to long
Diffstat (limited to 'MagickCore')
-rw-r--r-- | MagickCore/annotate.c | 8 | ||||
-rw-r--r-- | MagickCore/constitute.c | 4 | ||||
-rw-r--r-- | MagickCore/draw.c | 76 | ||||
-rw-r--r-- | MagickCore/effect.c | 8 | ||||
-rw-r--r-- | MagickCore/gem.c | 2 | ||||
-rw-r--r-- | MagickCore/image-private.h | 2 | ||||
-rw-r--r-- | MagickCore/image.c | 20 | ||||
-rw-r--r-- | MagickCore/pixel.c | 36 | ||||
-rw-r--r-- | MagickCore/property.c | 4 | ||||
-rw-r--r-- | MagickCore/shear.c | 22 | ||||
-rw-r--r-- | MagickCore/visual-effects.c | 40 |
11 files changed, 111 insertions, 111 deletions
diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index 37bd03733..71c255877 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -1722,8 +1722,8 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, if (status == MagickFalse) continue; - x_offset=MagickDoubleToLong(ceil(point.x-0.5)); - y_offset=MagickDoubleToLong(ceil(point.y+y-0.5)); + x_offset=CastDoubleToLong(ceil(point.x-0.5)); + y_offset=CastDoubleToLong(ceil(point.y+y-0.5)); if ((y_offset < 0) || (y_offset >= (ssize_t) image->rows)) continue; q=(Quantum *) NULL; @@ -1738,7 +1738,7 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, n=y*bitmap->bitmap.pitch; for (x=0; x < (ssize_t) bitmap->bitmap.width; x++, n++) { - x_offset=MagickDoubleToLong(ceil(point.x+x-0.5)); + x_offset=CastDoubleToLong(ceil(point.x+x-0.5)); if ((x_offset < 0) || (x_offset >= (ssize_t) image->columns)) { if (q != (Quantum *) NULL) @@ -2090,7 +2090,7 @@ static MagickBooleanType RenderPostscript(Image *image, crop_info=GetImageBoundingBox(annotate_image,exception); crop_info.height=(size_t) ((resolution.y/DefaultResolution)* ExpandAffine(&draw_info->affine)*draw_info->pointsize+0.5); - crop_info.y=MagickDoubleToLong(ceil((resolution.y/DefaultResolution)* + crop_info.y=CastDoubleToLong(ceil((resolution.y/DefaultResolution)* extent.y/8.0-0.5)); (void) FormatLocaleString(geometry,MagickPathExtent, "%.20gx%.20g%+.20g%+.20g",(double) crop_info.width,(double) diff --git a/MagickCore/constitute.c b/MagickCore/constitute.c index 13a089f0a..255681bd5 100644 --- a/MagickCore/constitute.c +++ b/MagickCore/constitute.c @@ -834,13 +834,13 @@ MagickExport Image *ReadImage(const ImageInfo *image_info, if ((flags & LessValue) != 0) { if (next->delay < (size_t) floor(geometry_info.rho+0.5)) - next->ticks_per_second=MagickDoubleToLong(floor( + next->ticks_per_second=CastDoubleToLong(floor( geometry_info.sigma+0.5)); } else next->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) - next->ticks_per_second=MagickDoubleToLong(floor( + next->ticks_per_second=CastDoubleToLong(floor( geometry_info.sigma+0.5)); } option=GetImageOption(image_info,"dispose"); diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 79eb35ed0..346a27f40 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -1233,8 +1233,8 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, edge.y2=MagickMin(max.y,(double) image->rows-1.0); inverse_affine=InverseAffineMatrix(affine); GetPixelInfo(image,&zero); - start=MagickDoubleToLong(ceil(edge.y1-0.5)); - stop=MagickDoubleToLong(floor(edge.y2+0.5)); + start=CastDoubleToLong(ceil(edge.y1-0.5)); + stop=CastDoubleToLong(floor(edge.y2+0.5)); source_view=AcquireVirtualCacheView(source,exception); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) @@ -1267,16 +1267,16 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, inverse_edge=AffineEdge(source,&inverse_affine,(double) y,&edge); if (inverse_edge.x2 < inverse_edge.x1) continue; - q=GetCacheViewAuthenticPixels(image_view,MagickDoubleToLong( - ceil(inverse_edge.x1-0.5)),y,(size_t) MagickDoubleToLong(floor( + q=GetCacheViewAuthenticPixels(image_view,CastDoubleToLong( + ceil(inverse_edge.x1-0.5)),y,(size_t) CastDoubleToLong(floor( inverse_edge.x2+0.5)-ceil(inverse_edge.x1-0.5)+1),1,exception); if (q == (Quantum *) NULL) continue; pixel=zero; composite=zero; x_offset=0; - for (x=MagickDoubleToLong(ceil(inverse_edge.x1-0.5)); - x <= MagickDoubleToLong(floor(inverse_edge.x2+0.5)); x++) + for (x=CastDoubleToLong(ceil(inverse_edge.x1-0.5)); + x <= CastDoubleToLong(floor(inverse_edge.x2+0.5)); x++) { point.x=(double) x*inverse_affine.sx+y*inverse_affine.ry+ inverse_affine.tx; @@ -2090,8 +2090,8 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, case UndefinedSpread: case PadSpread: { - if ((x != MagickDoubleToLong(ceil(gradient_vector->x1-0.5))) || - (y != MagickDoubleToLong(ceil(gradient_vector->y1-0.5)))) + if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) || + (y != CastDoubleToLong(ceil(gradient_vector->y1-0.5)))) { offset=GetStopColorOffset(gradient,x,y); if (gradient->type != RadialGradient) @@ -2118,8 +2118,8 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, } case ReflectSpread: { - if ((x != MagickDoubleToLong(ceil(gradient_vector->x1-0.5))) || - (y != MagickDoubleToLong(ceil(gradient_vector->y1-0.5)))) + if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) || + (y != CastDoubleToLong(ceil(gradient_vector->y1-0.5)))) { offset=GetStopColorOffset(gradient,x,y); if (gradient->type != RadialGradient) @@ -2160,8 +2160,8 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, antialias=MagickFalse; repeat=0.0; - if ((x != MagickDoubleToLong(ceil(gradient_vector->x1-0.5))) || - (y != MagickDoubleToLong(ceil(gradient_vector->y1-0.5)))) + if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) || + (y != CastDoubleToLong(ceil(gradient_vector->y1-0.5)))) { offset=GetStopColorOffset(gradient,x,y); if (gradient->type == LinearGradient) @@ -3456,21 +3456,21 @@ static MagickBooleanType RenderMVGContent(Image *image, (void) GetNextToken(q,&q,extent,token); (void) CopyMagickString(name,token,MagickPathExtent); (void) GetNextToken(q,&q,extent,token); - bounds.x=MagickDoubleToLong(ceil(GetDrawValue(token, + bounds.x=CastDoubleToLong(ceil(GetDrawValue(token, &next_token)-0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); (void) GetNextToken(q,&q,extent,token); if (*token == ',') (void) GetNextToken(q,&q,extent,token); - bounds.y=MagickDoubleToLong(ceil(GetDrawValue(token, + bounds.y=CastDoubleToLong(ceil(GetDrawValue(token, &next_token)-0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); (void) GetNextToken(q,&q,extent,token); if (*token == ',') (void) GetNextToken(q,&q,extent,token); - bounds.width=(size_t) MagickDoubleToLong(floor(GetDrawValue( + bounds.width=(size_t) CastDoubleToLong(floor(GetDrawValue( token,&next_token)+0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); @@ -3881,28 +3881,28 @@ static MagickBooleanType RenderMVGContent(Image *image, if (LocaleCompare("viewbox",keyword) == 0) { (void) GetNextToken(q,&q,extent,token); - graphic_context[n]->viewbox.x=MagickDoubleToLong(ceil( + graphic_context[n]->viewbox.x=CastDoubleToLong(ceil( GetDrawValue(token,&next_token)-0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); (void) GetNextToken(q,&q,extent,token); if (*token == ',') (void) GetNextToken(q,&q,extent,token); - graphic_context[n]->viewbox.y=MagickDoubleToLong(ceil( + graphic_context[n]->viewbox.y=CastDoubleToLong(ceil( GetDrawValue(token,&next_token)-0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); (void) GetNextToken(q,&q,extent,token); if (*token == ',') (void) GetNextToken(q,&q,extent,token); - graphic_context[n]->viewbox.width=(size_t) MagickDoubleToLong( + graphic_context[n]->viewbox.width=(size_t) CastDoubleToLong( floor(GetDrawValue(token,&next_token)+0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); (void) GetNextToken(q,&q,extent,token); if (*token == ',') (void) GetNextToken(q,&q,extent,token); - graphic_context[n]->viewbox.height=(size_t) MagickDoubleToLong( + graphic_context[n]->viewbox.height=(size_t) CastDoubleToLong( floor(GetDrawValue(token,&next_token)+0.5)); if (token == next_token) ThrowPointExpectedException(token,exception); @@ -4984,8 +4984,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, /* Draw point. */ - start_y=MagickDoubleToLong(ceil(bounds.y1-0.5)); - stop_y=MagickDoubleToLong(floor(bounds.y2+0.5)); + start_y=CastDoubleToLong(ceil(bounds.y1-0.5)); + stop_y=CastDoubleToLong(floor(bounds.y2+0.5)); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) @@ -5010,8 +5010,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, if (status == MagickFalse) continue; - start_x=MagickDoubleToLong(ceil(bounds.x1-0.5)); - stop_x=MagickDoubleToLong(floor(bounds.x2+0.5)); + start_x=CastDoubleToLong(ceil(bounds.x1-0.5)); + stop_x=CastDoubleToLong(floor(bounds.x2+0.5)); x=start_x; q=GetCacheViewAuthenticPixels(image_view,x,y,(size_t) (stop_x-x+1),1, exception); @@ -5023,8 +5023,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, GetPixelInfo(image,&pixel); for ( ; x <= stop_x; x++) { - if ((x == MagickDoubleToLong(ceil(primitive_info->point.x-0.5))) && - (y == MagickDoubleToLong(ceil(primitive_info->point.y-0.5)))) + if ((x == CastDoubleToLong(ceil(primitive_info->point.x-0.5))) && + (y == CastDoubleToLong(ceil(primitive_info->point.y-0.5)))) { GetFillColor(draw_info,x-start_x,y-start_y,&pixel,exception); SetPixelViaPixelInfo(image,&pixel,q); @@ -5045,8 +5045,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, /* Draw polygon or line. */ - start_y=MagickDoubleToLong(ceil(bounds.y1-0.5)); - stop_y=MagickDoubleToLong(floor(bounds.y2+0.5)); + start_y=CastDoubleToLong(ceil(bounds.y1-0.5)); + stop_y=CastDoubleToLong(floor(bounds.y2+0.5)); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) @@ -5068,8 +5068,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, if (status == MagickFalse) continue; - start_x=MagickDoubleToLong(ceil(bounds.x1-0.5)); - stop_x=MagickDoubleToLong(floor(bounds.x2+0.5)); + start_x=CastDoubleToLong(ceil(bounds.x1-0.5)); + stop_x=CastDoubleToLong(floor(bounds.x2+0.5)); q=GetCacheViewAuthenticPixels(image_view,start_x,y,(size_t) (stop_x-start_x+ 1),1,exception); if (q == (Quantum *) NULL) @@ -5170,8 +5170,8 @@ static void LogPrimitiveInfo(const PrimitiveInfo *primitive_info) coordinates, y; - x=MagickDoubleToLong(ceil(primitive_info->point.x-0.5)); - y=MagickDoubleToLong(ceil(primitive_info->point.y-0.5)); + x=CastDoubleToLong(ceil(primitive_info->point.x-0.5)); + y=CastDoubleToLong(ceil(primitive_info->point.y-0.5)); switch (primitive_info->primitive) { case AlphaPrimitive: @@ -5284,8 +5284,8 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, status&=SetImageMask(image,CompositePixelMask,draw_info->composite_mask, exception); } - x=MagickDoubleToLong(ceil(primitive_info->point.x-0.5)); - y=MagickDoubleToLong(ceil(primitive_info->point.y-0.5)); + x=CastDoubleToLong(ceil(primitive_info->point.x-0.5)); + y=CastDoubleToLong(ceil(primitive_info->point.y-0.5)); image_view=AcquireAuthenticCacheView(image,exception); switch (primitive_info->primitive) { @@ -5563,8 +5563,8 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, composite_images=DestroyImageList(composite_images); (void) SetImageProgressMonitor(composite_image,(MagickProgressMonitor) NULL,(void *) NULL); - x1=MagickDoubleToLong(ceil(primitive_info[1].point.x-0.5)); - y1=MagickDoubleToLong(ceil(primitive_info[1].point.y-0.5)); + x1=CastDoubleToLong(ceil(primitive_info[1].point.x-0.5)); + y1=CastDoubleToLong(ceil(primitive_info[1].point.y-0.5)); if (((x1 != 0L) && (x1 != (ssize_t) composite_image->columns)) || ((y1 != 0L) && (y1 != (ssize_t) composite_image->rows))) { @@ -6173,7 +6173,7 @@ static MagickBooleanType TraceArcPath(MVGInfo *mvg_info,const PointInfo start, else if ((theta > 0.0) && (sweep == MagickFalse)) theta-=2.0*MagickPI; - arc_segments=(size_t) MagickDoubleToLong(ceil(fabs((double) (theta/(0.5* + arc_segments=(size_t) CastDoubleToLong(ceil(fabs((double) (theta/(0.5* MagickPI+MagickEpsilon))))); status=MagickTrue; p=primitive_info; @@ -7529,7 +7529,7 @@ static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, theta.q=atan2(box_q[2].y-center.y,box_q[2].x-center.x); if (theta.q < theta.p) theta.q+=2.0*MagickPI; - arc_segments=(size_t) MagickDoubleToLong(ceil((double) ((theta. + arc_segments=(size_t) CastDoubleToLong(ceil((double) ((theta. q-theta.p)/(2.0*sqrt((double) (1.0/mid)))))); CheckPathExtent(MaxStrokePad,arc_segments+MaxStrokePad); stroke_q[q].x=box_q[1].x; @@ -7602,7 +7602,7 @@ static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, theta.q=atan2(box_p[2].y-center.y,box_p[2].x-center.x); if (theta.p < theta.q) theta.p+=2.0*MagickPI; - arc_segments=(size_t) MagickDoubleToLong(ceil((double) ((theta.p- + arc_segments=(size_t) CastDoubleToLong(ceil((double) ((theta.p- theta.q)/(2.0*sqrt((double) (1.0/mid)))))); CheckPathExtent(arc_segments+MaxStrokePad,MaxStrokePad); stroke_p[p++]=box_p[1]; diff --git a/MagickCore/effect.c b/MagickCore/effect.c index 6b6621ca9..c95fd0145 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -288,7 +288,7 @@ MagickExport Image *AdaptiveBlurImage(const Image *image,const double radius, center, j; - j=MagickDoubleToLong(ceil((double) width*(1.0-QuantumScale* + j=CastDoubleToLong(ceil((double) width*(1.0-QuantumScale* GetPixelIntensity(edge_image,r))-0.5)); if (j < 0) j=0; @@ -609,7 +609,7 @@ MagickExport Image *AdaptiveSharpenImage(const Image *image,const double radius, center, j; - j=MagickDoubleToLong(ceil((double) width*(1.0-QuantumScale* + j=CastDoubleToLong(ceil((double) width*(1.0-QuantumScale* GetPixelIntensity(edge_image,r))-0.5)); if (j < 0) j=0; @@ -2402,9 +2402,9 @@ MagickExport Image *MotionBlurImage(const Image *image,const double radius, point.y=(double) width*cos(DegreesToRadians(angle)); for (i=0; i < (ssize_t) width; i++) { - offset[i].x=MagickDoubleToLong(ceil((double) (i*point.y)/ + offset[i].x=CastDoubleToLong(ceil((double) (i*point.y)/ hypot(point.x,point.y)-0.5)); - offset[i].y=MagickDoubleToLong(ceil((double) (i*point.x)/ + offset[i].y=CastDoubleToLong(ceil((double) (i*point.x)/ hypot(point.x,point.y)-0.5)); } /* diff --git a/MagickCore/gem.c b/MagickCore/gem.c index a9862766f..f37990c6c 100644 --- a/MagickCore/gem.c +++ b/MagickCore/gem.c @@ -692,7 +692,7 @@ MagickPrivate void ConvertHWBToRGB(const double hue,const double whiteness, *blue=QuantumRange*v; return; } - i=MagickDoubleToLong(floor(6.0*hue)); + i=CastDoubleToLong(floor(6.0*hue)); f=6.0*hue-i; if ((i & 0x01) != 0) f=1.0-f; diff --git a/MagickCore/image-private.h b/MagickCore/image-private.h index 935eed5de..43e497136 100644 --- a/MagickCore/image-private.h +++ b/MagickCore/image-private.h @@ -55,7 +55,7 @@ static inline double DegreesToRadians(const double degrees) return((double) (MagickPI*degrees/180.0)); } -static inline ssize_t MagickDoubleToLong(const double value) +static inline ssize_t CastDoubleToLong(const double value) { if (IsNaN(value) != 0) return(0); diff --git a/MagickCore/image.c b/MagickCore/image.c index e0919c0ca..3f6925fb4 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -282,21 +282,21 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info, if ((flags & GreaterValue) != 0) { if ((double) image->delay > floor(geometry_info.rho+0.5)) - image->delay=(size_t) MagickDoubleToLong(floor( + image->delay=(size_t) CastDoubleToLong(floor( geometry_info.rho+0.5)); } else if ((flags & LessValue) != 0) { if ((double) image->delay < floor(geometry_info.rho+0.5)) - image->ticks_per_second=MagickDoubleToLong(floor( + image->ticks_per_second=CastDoubleToLong(floor( geometry_info.sigma+0.5)); } else - image->delay=(size_t) MagickDoubleToLong(floor( + image->delay=(size_t) CastDoubleToLong(floor( geometry_info.rho+0.5)); if ((flags & SigmaValue) != 0) - image->ticks_per_second=MagickDoubleToLong(floor( + image->ticks_per_second=CastDoubleToLong(floor( geometry_info.sigma+0.5)); } option=GetImageOption(image_info,"dispose"); @@ -881,18 +881,18 @@ MagickExport Image *CloneImage(const Image *image,const size_t columns, scale=1.0; if (image->columns != 0) scale=(double) columns/(double) image->columns; - clone_image->page.width=(size_t) MagickDoubleToLong(floor(scale* + clone_image->page.width=(size_t) CastDoubleToLong(floor(scale* image->page.width+0.5)); - clone_image->page.x=MagickDoubleToLong(ceil(scale*image->page.x-0.5)); - clone_image->tile_offset.x=MagickDoubleToLong(ceil(scale* + clone_image->page.x=CastDoubleToLong(ceil(scale*image->page.x-0.5)); + clone_image->tile_offset.x=CastDoubleToLong(ceil(scale* image->tile_offset.x-0.5)); scale=1.0; if (image->rows != 0) scale=(double) rows/(double) image->rows; - clone_image->page.height=(size_t) MagickDoubleToLong(floor(scale* + clone_image->page.height=(size_t) CastDoubleToLong(floor(scale* image->page.height+0.5)); - clone_image->page.y=MagickDoubleToLong(ceil(scale*image->page.y-0.5)); - clone_image->tile_offset.y=MagickDoubleToLong(ceil(scale* + clone_image->page.y=CastDoubleToLong(ceil(scale*image->page.y-0.5)); + clone_image->tile_offset.y=CastDoubleToLong(ceil(scale* image->tile_offset.y-0.5)); clone_image->cache=ClonePixelCache(image->cache); if (SetImageExtent(clone_image,columns,rows,exception) == MagickFalse) diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 5e345eedf..85bf51e1f 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -4524,8 +4524,8 @@ MagickExport MagickBooleanType InterpolatePixelChannel( status=MagickTrue; *pixel=0.0; traits=GetPixelChannelTraits(image,channel); - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x))); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y))); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x))); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y))); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=image->interpolate; @@ -4542,8 +4542,8 @@ MagickExport MagickBooleanType InterpolatePixelChannel( if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); } else if (interpolate == Average16InterpolatePixel) @@ -4726,8 +4726,8 @@ MagickExport MagickBooleanType InterpolatePixelChannel( } case NearestInterpolatePixel: { - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) { @@ -4944,8 +4944,8 @@ MagickExport MagickBooleanType InterpolatePixelChannels( assert(source->signature == MagickCoreSignature); assert(source_view != (CacheView *) NULL); status=MagickTrue; - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x))); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y))); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x))); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y))); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=source->interpolate; @@ -4962,8 +4962,8 @@ MagickExport MagickBooleanType InterpolatePixelChannels( if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); } else if (interpolate == Average16InterpolatePixel) @@ -5227,8 +5227,8 @@ MagickExport MagickBooleanType InterpolatePixelChannels( } case NearestInterpolatePixel: { - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); p=GetCacheViewVirtualPixels(source_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) { @@ -5511,8 +5511,8 @@ MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image, assert(image->signature == MagickCoreSignature); assert(image_view != (CacheView *) NULL); status=MagickTrue; - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x))); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y))); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x))); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y))); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=image->interpolate; @@ -5531,8 +5531,8 @@ MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image, if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)-1.0); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)-1.0); } else if (interpolate == Average16InterpolatePixel) { @@ -5856,8 +5856,8 @@ MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image, } case NearestInterpolatePixel: { - x_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); - y_offset=MagickDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); + x_offset=CastDoubleToLong(floor(ConstrainPixelOffset(x)+0.5)); + y_offset=CastDoubleToLong(floor(ConstrainPixelOffset(y)+0.5)); p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) { diff --git a/MagickCore/property.c b/MagickCore/property.c index c08106ffe..4116e9bb9 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -4355,13 +4355,13 @@ MagickExport MagickBooleanType SetImageProperty(Image *image, if ((flags & LessValue) != 0) { if ((double) image->delay < floor(geometry_info.rho+0.5)) - image->delay=MagickDoubleToLong( + image->delay=CastDoubleToLong( floor(geometry_info.sigma+0.5)); } else image->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) - image->ticks_per_second=MagickDoubleToLong(floor( + image->ticks_per_second=CastDoubleToLong(floor( geometry_info.sigma+0.5)); return(MagickTrue); } diff --git a/MagickCore/shear.c b/MagickCore/shear.c index 65520704f..b5520b053 100644 --- a/MagickCore/shear.c +++ b/MagickCore/shear.c @@ -163,10 +163,10 @@ static MagickBooleanType CropToFitImage(Image **image, if (max.y < extent[i].y) max.y=extent[i].y; } - geometry.x=MagickDoubleToLong(ceil(min.x-0.5)); - geometry.y=MagickDoubleToLong(ceil(min.y-0.5)); - geometry.width=(size_t) MagickDoubleToLong(floor(max.x-min.x+0.5)); - geometry.height=(size_t) MagickDoubleToLong(floor(max.y-min.y+0.5)); + geometry.x=CastDoubleToLong(ceil(min.x-0.5)); + geometry.y=CastDoubleToLong(ceil(min.y-0.5)); + geometry.width=(size_t) CastDoubleToLong(floor(max.x-min.x+0.5)); + geometry.height=(size_t) CastDoubleToLong(floor(max.y-min.y+0.5)); page=(*image)->page; (void) ParseAbsoluteGeometry("0x0+0+0",&(*image)->page); crop_image=CropImage(*image,&geometry,exception); @@ -1217,7 +1217,7 @@ static MagickBooleanType XShearImage(Image *image,const double degrees, displacement*=(-1.0); direction=LEFT; } - step=MagickDoubleToLong(floor((double) displacement)); + step=CastDoubleToLong(floor((double) displacement)); area=(double) (displacement-step); step++; pixel=background; @@ -1434,7 +1434,7 @@ static MagickBooleanType YShearImage(Image *image,const double degrees, displacement*=(-1.0); direction=UP; } - step=MagickDoubleToLong(floor((double) displacement)); + step=CastDoubleToLong(floor((double) displacement)); area=(double) (displacement-step); step++; pixel=background; @@ -1617,11 +1617,11 @@ MagickExport Image *ShearImage(const Image *image,const double x_shear, /* Compute image size. */ - bounds.width=image->columns+MagickDoubleToLong(floor(fabs(shear.x)* + bounds.width=image->columns+CastDoubleToLong(floor(fabs(shear.x)* image->rows+0.5)); - bounds.x=MagickDoubleToLong(ceil((double) image->columns+((fabs(shear.x)* + bounds.x=CastDoubleToLong(ceil((double) image->columns+((fabs(shear.x)* image->rows)-image->columns)/2.0-0.5)); - bounds.y=MagickDoubleToLong(ceil((double) image->rows+((fabs(shear.y)* + bounds.y=CastDoubleToLong(ceil((double) image->rows+((fabs(shear.y)* bounds.width)-image->rows)/2.0-0.5)); /* Surround image with border. @@ -1770,9 +1770,9 @@ MagickExport Image *ShearRotateImage(const Image *image,const double degrees, bounds.height=(size_t) floor(fabs((double) bounds.width*shear.y)+height+0.5); shear_width=(size_t) floor(fabs((double) bounds.height*shear.x)+ bounds.width+0.5); - bounds.x=MagickDoubleToLong(floor((double) ((shear_width > bounds.width) ? + bounds.x=CastDoubleToLong(floor((double) ((shear_width > bounds.width) ? width : bounds.width-shear_width+2)/2.0+0.5)); - bounds.y=MagickDoubleToLong(floor(((double) bounds.height-height+2)/2.0+0.5)); + bounds.y=CastDoubleToLong(floor(((double) bounds.height-height+2)/2.0+0.5)); /* Surround image with a border. */ diff --git a/MagickCore/visual-effects.c b/MagickCore/visual-effects.c index 517f24edb..560beab34 100644 --- a/MagickCore/visual-effects.c +++ b/MagickCore/visual-effects.c @@ -1437,8 +1437,8 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, */ depth--; attenuate++; - x_mid=MagickDoubleToLong(ceil((segment->x1+segment->x2)/2-0.5)); - y_mid=MagickDoubleToLong(ceil((segment->y1+segment->y2)/2-0.5)); + x_mid=CastDoubleToLong(ceil((segment->x1+segment->x2)/2-0.5)); + y_mid=CastDoubleToLong(ceil((segment->y1+segment->y2)/2-0.5)); local_info=(*segment); local_info.x2=(double) x_mid; local_info.y2=(double) y_mid; @@ -1461,8 +1461,8 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, &local_info,attenuate,depth,exception); return(status == 0 ? MagickFalse : MagickTrue); } - x_mid=MagickDoubleToLong(ceil((segment->x1+segment->x2)/2-0.5)); - y_mid=MagickDoubleToLong(ceil((segment->y1+segment->y2)/2-0.5)); + x_mid=CastDoubleToLong(ceil((segment->x1+segment->x2)/2-0.5)); + y_mid=CastDoubleToLong(ceil((segment->y1+segment->y2)/2-0.5)); if ((fabs(segment->x1-x_mid) < MagickEpsilon) && (fabs(segment->x2-x_mid) < MagickEpsilon) && (fabs(segment->y1-y_mid) < MagickEpsilon) && @@ -1479,10 +1479,10 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, /* Left pixel. */ - x=MagickDoubleToLong(ceil(segment->x1-0.5)); - u=GetCacheViewVirtualPixels(u_view,x,MagickDoubleToLong(ceil( + x=CastDoubleToLong(ceil(segment->x1-0.5)); + u=GetCacheViewVirtualPixels(u_view,x,CastDoubleToLong(ceil( segment->y1-0.5)),1,1,exception); - v=GetCacheViewVirtualPixels(v_view,x,MagickDoubleToLong(ceil( + v=GetCacheViewVirtualPixels(v_view,x,CastDoubleToLong(ceil( segment->y2-0.5)),1,1,exception); q=QueueCacheViewAuthenticPixels(image_view,x,y_mid,1,1,exception); if ((u == (const Quantum *) NULL) || (v == (const Quantum *) NULL) || @@ -1502,10 +1502,10 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, /* Right pixel. */ - x=MagickDoubleToLong(ceil(segment->x2-0.5)); - u=GetCacheViewVirtualPixels(u_view,x,MagickDoubleToLong(ceil( + x=CastDoubleToLong(ceil(segment->x2-0.5)); + u=GetCacheViewVirtualPixels(u_view,x,CastDoubleToLong(ceil( segment->y1-0.5)),1,1,exception); - v=GetCacheViewVirtualPixels(v_view,x,MagickDoubleToLong(ceil( + v=GetCacheViewVirtualPixels(v_view,x,CastDoubleToLong(ceil( segment->y2-0.5)),1,1,exception); q=QueueCacheViewAuthenticPixels(image_view,x,y_mid,1,1,exception); if ((u == (const Quantum *) NULL) || (v == (const Quantum *) NULL) || @@ -1531,10 +1531,10 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, /* Bottom pixel. */ - y=MagickDoubleToLong(ceil(segment->y2-0.5)); - u=GetCacheViewVirtualPixels(u_view,MagickDoubleToLong(ceil( + y=CastDoubleToLong(ceil(segment->y2-0.5)); + u=GetCacheViewVirtualPixels(u_view,CastDoubleToLong(ceil( segment->x1-0.5)),y,1,1,exception); - v=GetCacheViewVirtualPixels(v_view,MagickDoubleToLong(ceil( + v=GetCacheViewVirtualPixels(v_view,CastDoubleToLong(ceil( segment->x2-0.5)),y,1,1,exception); q=QueueCacheViewAuthenticPixels(image_view,x_mid,y,1,1,exception); if ((u == (const Quantum *) NULL) || (v == (const Quantum *) NULL) || @@ -1555,10 +1555,10 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, /* Top pixel. */ - y=MagickDoubleToLong(ceil(segment->y1-0.5)); - u=GetCacheViewVirtualPixels(u_view,MagickDoubleToLong(ceil( + y=CastDoubleToLong(ceil(segment->y1-0.5)); + u=GetCacheViewVirtualPixels(u_view,CastDoubleToLong(ceil( segment->x1-0.5)),y,1,1,exception); - v=GetCacheViewVirtualPixels(v_view,MagickDoubleToLong(ceil( + v=GetCacheViewVirtualPixels(v_view,CastDoubleToLong(ceil( segment->x2-0.5)),y,1,1,exception); q=QueueCacheViewAuthenticPixels(image_view,x_mid,y,1,1,exception); if ((u == (const Quantum *) NULL) || (v == (const Quantum *) NULL) || @@ -1581,11 +1581,11 @@ static MagickBooleanType PlasmaImageProxy(Image *image,CacheView *image_view, /* Middle pixel. */ - x=MagickDoubleToLong(ceil(segment->x1-0.5)); - y=MagickDoubleToLong(ceil(segment->y1-0.5)); + x=CastDoubleToLong(ceil(segment->x1-0.5)); + y=CastDoubleToLong(ceil(segment->y1-0.5)); u=GetCacheViewVirtualPixels(u_view,x,y,1,1,exception); - x=MagickDoubleToLong(ceil(segment->x2-0.5)); - y=MagickDoubleToLong(ceil(segment->y2-0.5)); + x=CastDoubleToLong(ceil(segment->x2-0.5)); + y=CastDoubleToLong(ceil(segment->y2-0.5)); v=GetCacheViewVirtualPixels(v_view,x,y,1,1,exception); q=QueueCacheViewAuthenticPixels(image_view,x_mid,y_mid,1,1,exception); if ((u == (const Quantum *) NULL) || (v == (const Quantum *) NULL) || |