From a86a5cb565b7120f58b377f95e606867f28b08fe Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 14 Oct 2012 13:40:33 +0000 Subject: [PATCH] --- MagickCore/colorspace.c | 106 +++++++++++++++-------------- MagickCore/composite.c | 4 +- MagickCore/enhance.c | 6 +- MagickCore/fx.c | 2 +- MagickCore/gem.c | 4 +- MagickCore/pixel-accessor.h | 126 ++++++++++++++++++----------------- MagickCore/xwindow-private.h | 2 +- MagickCore/xwindow.c | 2 +- PerlMagick/t/write.t | 4 +- 9 files changed, 132 insertions(+), 124 deletions(-) diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index dec5e3575..2c5fa2e3d 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -430,7 +430,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, red=DecodesRGBGamma((double) GetPixelRed(image,q)); green=DecodesRGBGamma((double) GetPixelGreen(image,q)); blue=DecodesRGBGamma((double) GetPixelBlue(image,q)); - gray=0.298839*red+0.586811*green+0.114350*blue; + gray=0.298839f*red+0.586811f*green+0.114350f*blue; SetPixelGray(image,ClampToQuantum(gray),q); q+=GetPixelChannels(image); } @@ -1341,7 +1341,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YCbCr tables (ITU-R BT.601): - Y = 0.2988390*R+0.5868110*G+0.1143500*B + Y = 0.298839f0*R+0.586811f0*G+0.114350f0*B Cb= -0.1687367*R-0.3312640*G+0.5000000*B Cr= 0.5000000*R-0.4186880*G-0.0813120*B @@ -1356,15 +1356,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.298839*i; - y_map[i].x=0.586811*i; - z_map[i].x=0.114350*i; - x_map[i].y=(-0.1687367)*i; - y_map[i].y=(-0.331264)*i; - z_map[i].y=0.500000*i; - x_map[i].z=0.500000*i; - y_map[i].z=(-0.418688)*i; - z_map[i].z=(-0.081312)*i; + x_map[i].x=(MagickRealType) (0.298839f*(float) i); + y_map[i].x=(MagickRealType) (0.586811f*(float) i); + z_map[i].x=(MagickRealType) (0.114350f*(float) i); + x_map[i].y=(MagickRealType) (-0.1687367f*(float) i); + y_map[i].y=(MagickRealType) (-0.331264f*(float) i); + z_map[i].y=(MagickRealType) (0.500000f*(float) i); + x_map[i].z=(MagickRealType) (0.500000f*(float) i); + y_map[i].z=(MagickRealType) (-0.418688f*(float) i); + z_map[i].z=(MagickRealType) (-0.081312f*(float) i); } break; } @@ -1405,9 +1405,9 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YCC tables: - Y = 0.298839*R+0.586811*G+0.114350*B - C1= -0.298839*R-0.586811*G+0.88600*B - C2= 0.70100*R-0.586811*G-0.114350*B + Y = 0.298839f*R+0.586811f*G+0.114350f*B + C1= -0.298839f*R-0.586811f*G+0.88600*B + C2= 0.70100*R-0.586811f*G-0.114350f*B YCC is scaled by 1.3584. C1 zero is 156 and C2 is at 137. */ @@ -1444,7 +1444,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YIQ tables: - Y = 0.298839*R+0.586811*G+0.114350*B + Y = 0.298839f*R+0.586811f*G+0.114350f*B I = 0.595716*R-0.274453*G-0.321263*B Q = 0.211456*R-0.522591*G+0.311135*B @@ -1459,15 +1459,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.298839*i; - y_map[i].x=0.586811*i; - z_map[i].x=0.114350*i; - x_map[i].y=0.595716*i; - y_map[i].y=(-0.274453)*i; - z_map[i].y=(-0.321263)*i; - x_map[i].z=0.211456*i; - y_map[i].z=(-0.522591)*i; - z_map[i].z=0.311135*i; + x_map[i].x=(MagickRealType) (0.298839f*(float) i); + y_map[i].x=(MagickRealType) (0.586811f*(float) i); + z_map[i].x=(MagickRealType) (0.114350f*(float) i); + x_map[i].y=(MagickRealType) (0.595716*(float) i); + y_map[i].y=(MagickRealType) (-0.274453f*(float) i); + z_map[i].y=(MagickRealType) (-0.321263f*(float) i); + x_map[i].z=(MagickRealType) (0.211456f*(float) i); + y_map[i].z=(MagickRealType) (-0.522591f*(float) i); + z_map[i].z=(MagickRealType) (0.311135f*(float) i); } break; } @@ -1476,7 +1476,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YPbPr tables (ITU-R BT.601): - Y = 0.2988390*R+0.5868110*G+0.1143500*B + Y = 0.298839f0*R+0.586811f0*G+0.114350f0*B Pb= -0.1687367*R-0.3312640*G+0.5000000*B Pr= 0.5000000*R-0.4186880*G-0.0813120*B @@ -1491,15 +1491,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.298839*i; - y_map[i].x=0.586811*i; - z_map[i].x=0.114350*i; - x_map[i].y=(-0.1687367)*i; - y_map[i].y=(-0.331264)*i; - z_map[i].y=0.500000*i; - x_map[i].z=0.500000*i; - y_map[i].z=(-0.418688)*i; - z_map[i].z=(-0.081312)*i; + x_map[i].x=(MagickRealType) (0.298839f*(float) i); + y_map[i].x=(MagickRealType) (0.586811f*(float) i); + z_map[i].x=(MagickRealType) (0.114350f*(float) i); + x_map[i].y=(MagickRealType) (-0.1687367f*(float) i); + y_map[i].y=(MagickRealType) (-0.331264*(float) i); + z_map[i].y=(MagickRealType) (0.500000f*(float) i); + x_map[i].z=(MagickRealType) (0.500000f*(float) i); + y_map[i].z=(MagickRealType) (-0.418688f*(float) i); + z_map[i].z=(MagickRealType) (-0.081312f*(float) i); } break; } @@ -1508,7 +1508,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YUV tables: - Y = 0.298839*R+0.586811*G+0.114350*B + Y = 0.298839f*R+0.586811f*G+0.114350f*B U = -0.147130*R-0.288860*G+0.436000*B V = 0.615000*R-0.514990*G-0.100010*B @@ -1523,15 +1523,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.298839*i; - y_map[i].x=0.586811*i; - z_map[i].x=0.114350*i; - x_map[i].y=(-0.147130)*i; - y_map[i].y=(-0.288860)*i; - z_map[i].y=0.436000*i; - x_map[i].z=0.615000*i; - y_map[i].z=(-0.514990)*i; - z_map[i].z=(-0.100001)*i; + x_map[i].x=(MagickRealType) (0.298839f*(float) i); + y_map[i].x=(MagickRealType) (0.586811f*(float) i); + z_map[i].x=(MagickRealType) (0.114350f*(float) i); + x_map[i].y=(MagickRealType) (-0.147130f*(float) i); + y_map[i].y=(MagickRealType) (-0.288860f*(float) i); + z_map[i].y=(MagickRealType) (0.436000f*(float) i); + x_map[i].z=(MagickRealType) (0.615000f*(float) i); + y_map[i].z=(MagickRealType) (-0.514990f*(float) i); + z_map[i].z=(MagickRealType) (-0.100001f*(float) i); } break; } @@ -3508,9 +3508,12 @@ static MagickBooleanType TransformsRGBImage(Image *image, } else { - pixel.red=EncodesRGBGamma(ScaleMapToQuantum(pixel.red)); - pixel.green=EncodesRGBGamma(ScaleMapToQuantum(pixel.green)); - pixel.blue=EncodesRGBGamma(ScaleMapToQuantum(pixel.blue)); + pixel.red=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.red)); + pixel.green=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.green)); + pixel.blue=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.blue)); } SetPixelRed(image,ClampToQuantum(pixel.red),q); SetPixelGreen(image,ClampToQuantum(pixel.green),q); @@ -3573,9 +3576,12 @@ static MagickBooleanType TransformsRGBImage(Image *image, } else { - pixel.red=EncodesRGBGamma(ScaleMapToQuantum(pixel.red)); - pixel.green=EncodesRGBGamma(ScaleMapToQuantum(pixel.green)); - pixel.blue=EncodesRGBGamma(ScaleMapToQuantum(pixel.blue)); + pixel.red=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.red)); + pixel.green=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.green)); + pixel.blue=EncodesRGBGamma((MagickRealType) + ScaleMapToQuantum(pixel.blue)); } image->colormap[i].red=(double) ClampToQuantum(pixel.red); image->colormap[i].green=(double) ClampToQuantum(pixel.green); diff --git a/MagickCore/composite.c b/MagickCore/composite.c index 99ad303bd..4ec1dad5d 100644 --- a/MagickCore/composite.c +++ b/MagickCore/composite.c @@ -267,7 +267,7 @@ static void HCLComposite(const double hue,const double chroma,const double luma, r=c; b=x; } - m=luma-(0.298839*r+0.586811*g+0.114350*b); + m=luma-(0.298839f*r+0.586811f*g+0.114350f*b); /* Choose saturation strategy to clip it into the RGB cube; hue and luma are preserved and chroma may be changed. @@ -325,7 +325,7 @@ static void CompositeHCL(const double red,const double green,const double blue, h=((r-g)/c)+4.0; *hue=(h/6.0); *chroma=QuantumScale*c; - *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b); + *luma=QuantumScale*(0.298839f*r+0.586811f*g+0.114350f*b); } static MagickBooleanType CompositeOverImage(Image *image, diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 4437c79ef..754203317 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -723,8 +723,8 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, double luma; - luma=0.21267*image->colormap[i].red+0.71526*image->colormap[i].green+ - 0.07217*image->colormap[i].blue; + luma=0.21267f*image->colormap[i].red+0.71526*image->colormap[i].green+ + 0.07217f*image->colormap[i].blue; image->colormap[i].red=luma+color_correction.saturation*cdl_map[ ScaleQuantumToMap(ClampToQuantum(image->colormap[i].red))].red-luma; image->colormap[i].green=luma+color_correction.saturation*cdl_map[ @@ -763,7 +763,7 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, } for (x=0; x < (ssize_t) image->columns; x++) { - luma=0.21267*GetPixelRed(image,q)+0.71526*GetPixelGreen(image,q)+0.07217* + luma=0.21267f*GetPixelRed(image,q)+0.71526*GetPixelGreen(image,q)+0.07217f* GetPixelBlue(image,q); SetPixelRed(image,ClampToQuantum(luma+color_correction.saturation* (cdl_map[ScaleQuantumToMap(GetPixelRed(image,q))].red-luma)),q); diff --git a/MagickCore/fx.c b/MagickCore/fx.c index aa9fc31ae..fe226dddc 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -1727,7 +1727,7 @@ static double FxGetSymbol(FxInfo *fx_info,const PixelChannel channel, double luminence; - luminence=0.21267*pixel.red+0.71516*pixel.green+0.07217*pixel.blue; + luminence=0.21267f*pixel.red+0.71516f*pixel.green+0.07217f*pixel.blue; return(QuantumScale*luminence); } break; diff --git a/MagickCore/gem.c b/MagickCore/gem.c index 64608bc35..8b89d2739 100644 --- a/MagickCore/gem.c +++ b/MagickCore/gem.c @@ -145,7 +145,7 @@ MagickPrivate void ConvertHCLToRGB(const double hue,const double chroma, r=c; b=x; } - m=luma-(0.298839*r+0.586811*g+0.114350*b); + m=luma-(0.298839f*r+0.586811f*g+0.114350f*b); /* Choose saturation strategy to clip it into the RGB cube; hue and luma are preserved and chroma may be changed. @@ -504,7 +504,7 @@ MagickPrivate void ConvertRGBToHCL(const double red,const double green, h=((r-g)/c)+4.0; *hue=(h/6.0); *chroma=QuantumScale*c; - *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b); + *luma=QuantumScale*(0.298839f*r+0.586811f*g+0.114350f*b); } /* diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index 090606d5b..0173d3fa8 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -32,18 +32,18 @@ extern "C" { #undef index -static inline double DecodesRGBGamma(const double pixel) +static inline MagickRealType DecodesRGBGamma(const MagickRealType pixel) { if (pixel <= (0.0404482362771076*QuantumRange)) - return(pixel/12.92); - return(QuantumRange*pow((QuantumScale*pixel+0.055)/1.055,2.4)); + return(pixel/12.92f); + return(QuantumRange*pow((double) (QuantumScale*pixel+0.055)/1.055,2.4)); } -static inline double EncodesRGBGamma(const double pixel) +static inline MagickRealType EncodesRGBGamma(const MagickRealType pixel) { if (pixel <= (0.0031306684425005883*QuantumRange)) - return(12.92*pixel); - return(QuantumRange*(1.055*pow(QuantumScale*pixel,1.0/2.4)-0.055)); + return(12.92f*pixel); + return(QuantumRange*(1.055*pow((double) QuantumScale*pixel,1.0/2.4)-0.055)); } static inline Quantum GetPixela(const Image *restrict image, @@ -194,8 +194,8 @@ static inline PixelTrait GetPixelIndexTraits(const Image *restrict image) return(image->channel_map[IndexPixelChannel].traits); } -static inline double GetPixelInfoChannel(const PixelInfo *restrict pixel_info, - const PixelChannel channel) +static inline MagickRealType GetPixelInfoChannel( + const PixelInfo *restrict pixel_info,const PixelChannel channel) { switch (channel) { @@ -205,13 +205,14 @@ static inline double GetPixelInfoChannel(const PixelInfo *restrict pixel_info, case BlackPixelChannel: return(pixel_info->black); case AlphaPixelChannel: return(pixel_info->alpha); case IndexPixelChannel: return(pixel_info->index); - default: return(0.0); + default: return((MagickRealType) 0.0); } } -static inline double GetPixelInfoIntensity(const PixelInfo *restrict pixel_info) +static inline MagickRealType GetPixelInfoIntensity( + const PixelInfo *restrict pixel_info) { - double + MagickRealType blue, green, red; @@ -219,17 +220,18 @@ static inline double GetPixelInfoIntensity(const PixelInfo *restrict pixel_info) if (pixel_info->colorspace == GRAYColorspace) return(pixel_info->red); if (pixel_info->colorspace != sRGBColorspace) - return(0.298839*pixel_info->red+0.586811*pixel_info->green+ - 0.114350*pixel_info->blue); + return(0.298839f*pixel_info->red+0.586811f*pixel_info->green+ + 0.114350f*pixel_info->blue); red=DecodesRGBGamma(pixel_info->red); green=DecodesRGBGamma(pixel_info->green); blue=DecodesRGBGamma(pixel_info->blue); - return(0.298839*red+0.586811*green+0.114350*blue); + return(0.298839f*red+0.586811f*green+0.114350f*blue); } -static inline double GetPixelInfoLuminance(const PixelInfo *restrict pixel_info) +static inline MagickRealType GetPixelInfoLuminance( + const PixelInfo *restrict pixel_info) { - double + MagickRealType blue, green, red; @@ -237,35 +239,35 @@ static inline double GetPixelInfoLuminance(const PixelInfo *restrict pixel_info) if (pixel_info->colorspace == GRAYColorspace) return(pixel_info->red); if (pixel_info->colorspace != sRGBColorspace) - return(0.21267*pixel_info->red+0.71516*pixel_info->green+ - 0.07217*pixel_info->blue); + return(0.21267f*pixel_info->red+0.71516f*pixel_info->green+ + 0.07217f*pixel_info->blue); red=DecodesRGBGamma(pixel_info->red); green=DecodesRGBGamma(pixel_info->green); blue=DecodesRGBGamma(pixel_info->blue); - return(0.21267*red+0.71516*green+0.07217*blue); + return(0.21267f*red+0.71516f*green+0.07217f*blue); } -static inline double GetPixelIntensity(const Image *restrict image, +static inline MagickRealType GetPixelIntensity(const Image *restrict image, const Quantum *restrict pixel) { - double + MagickRealType blue, green, red; if (image->colorspace == GRAYColorspace) - return((double) pixel[image->channel_map[GrayPixelChannel].offset]); + return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]); if (image->colorspace != sRGBColorspace) - return(0.298839*pixel[image->channel_map[RedPixelChannel].offset]+ - 0.586811*pixel[image->channel_map[GreenPixelChannel].offset]+ - 0.114350*pixel[image->channel_map[BluePixelChannel].offset]); - red=DecodesRGBGamma((double) + return(0.298839f*pixel[image->channel_map[RedPixelChannel].offset]+ + 0.586811f*pixel[image->channel_map[GreenPixelChannel].offset]+ + 0.114350f*pixel[image->channel_map[BluePixelChannel].offset]); + red=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]); - green=DecodesRGBGamma((double) + green=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset]); - blue=DecodesRGBGamma((double) + blue=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[BluePixelChannel].offset]); - return(0.298839*red+0.586811*green+0.114350*blue); + return(0.298839f*red+0.586811f*green+0.114350f*blue); } static inline Quantum GetPixelL(const Image *restrict image, @@ -274,27 +276,27 @@ static inline Quantum GetPixelL(const Image *restrict image, return(pixel[image->channel_map[LPixelChannel].offset]); } -static inline double GetPixelLuminance(const Image *restrict image, +static inline MagickRealType GetPixelLuminance(const Image *restrict image, const Quantum *restrict pixel) { - double + MagickRealType blue, green, red; if (image->colorspace == GRAYColorspace) - return((double) pixel[image->channel_map[GrayPixelChannel].offset]); + return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]); if (image->colorspace != sRGBColorspace) - return(0.298839*pixel[image->channel_map[RedPixelChannel].offset]+ - 0.586811*pixel[image->channel_map[GreenPixelChannel].offset]+ - 0.114350*pixel[image->channel_map[BluePixelChannel].offset]); - red=DecodesRGBGamma((double) + return(0.298839f*pixel[image->channel_map[RedPixelChannel].offset]+ + 0.586811f*pixel[image->channel_map[GreenPixelChannel].offset]+ + 0.114350f*pixel[image->channel_map[BluePixelChannel].offset]); + red=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]); - green=DecodesRGBGamma((double) + green=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset]); - blue=DecodesRGBGamma((double) + blue=DecodesRGBGamma((MagickRealType) pixel[image->channel_map[BluePixelChannel].offset]); - return(0.21267*red+0.71516*green+0.07217*blue); + return(0.21267f*red+0.71516f*green+0.07217f*blue); } static inline Quantum GetPixelMagenta(const Image *restrict image, @@ -353,23 +355,23 @@ static inline PixelTrait GetPixelRedTraits(const Image *restrict image) static inline void GetPixelInfoPixel(const Image *restrict image, const Quantum *restrict pixel,PixelInfo *restrict pixel_info) { - pixel_info->red=(double) + pixel_info->red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]; - pixel_info->green=(double) + pixel_info->green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset]; - pixel_info->blue=(double) + pixel_info->blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset]; - pixel_info->black=0.0; + pixel_info->black=0.0f; if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait) - pixel_info->black=(double) + pixel_info->black=(MagickRealType) pixel[image->channel_map[BlackPixelChannel].offset]; - pixel_info->alpha=OpaqueAlpha; + pixel_info->alpha=(MagickRealType) OpaqueAlpha; if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) - pixel_info->alpha=(double) + pixel_info->alpha=(MagickRealType) pixel[image->channel_map[AlphaPixelChannel].offset]; - pixel_info->index=0.0; + pixel_info->index=0.0f; if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait) - pixel_info->index=(double) + pixel_info->index=(MagickRealType) pixel[image->channel_map[IndexPixelChannel].offset]; } @@ -401,22 +403,22 @@ static inline PixelTrait GetPixelYellowTraits(const Image *restrict image) return(image->channel_map[YellowPixelChannel].traits); } -static inline double AbsolutePixelValue(const double x) +static inline MagickRealType AbsolutePixelValue(const MagickRealType x) { - return(x < 0.0 ? -x : x); + return(x < 0.0f ? -x : x); } static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image, const Quantum *restrict p,const PixelInfo *restrict q) { - double + MagickRealType blue, green, red; - red=(double) p[image->channel_map[RedPixelChannel].offset]; - green=(double) p[image->channel_map[GreenPixelChannel].offset]; - blue=(double) p[image->channel_map[BluePixelChannel].offset]; + red=(MagickRealType) p[image->channel_map[RedPixelChannel].offset]; + green=(MagickRealType) p[image->channel_map[GreenPixelChannel].offset]; + blue=(MagickRealType) p[image->channel_map[BluePixelChannel].offset]; if ((AbsolutePixelValue(red-q->red) < MagickEpsilon) && (AbsolutePixelValue(green-q->green) < MagickEpsilon) && (AbsolutePixelValue(blue-q->blue) < MagickEpsilon)) @@ -427,14 +429,14 @@ static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image, static inline MagickBooleanType IsPixelGray(const Image *restrict image, const Quantum *restrict pixel) { - double + MagickRealType blue, green, red; - red=(double) pixel[image->channel_map[RedPixelChannel].offset]; - green=(double) pixel[image->channel_map[GreenPixelChannel].offset]; - blue=(double) pixel[image->channel_map[BluePixelChannel].offset]; + red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]; + green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset]; + blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset]; if ((AbsolutePixelValue(red-green) < MagickEpsilon) && (AbsolutePixelValue(green-blue) < MagickEpsilon)) return(MagickTrue); @@ -475,17 +477,17 @@ static inline MagickBooleanType IsPixelInfoEquivalent( static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image, const Quantum *restrict pixel) { - double + MagickRealType blue, green, red; - red=(double) pixel[image->channel_map[RedPixelChannel].offset]; + red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]; if ((AbsolutePixelValue(red) >= MagickEpsilon) || (AbsolutePixelValue(red-QuantumRange) >= MagickEpsilon)) return(MagickFalse); - green=(double) pixel[image->channel_map[GreenPixelChannel].offset]; - blue=(double) pixel[image->channel_map[BluePixelChannel].offset]; + green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset]; + blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset]; if ((AbsolutePixelValue(red-green) < MagickEpsilon) && (AbsolutePixelValue(green-blue) < MagickEpsilon)) return(MagickTrue); diff --git a/MagickCore/xwindow-private.h b/MagickCore/xwindow-private.h index 91a4ae3f8..a3814ce25 100644 --- a/MagickCore/xwindow-private.h +++ b/MagickCore/xwindow-private.h @@ -606,7 +606,7 @@ static inline double XPixelIntensity(const XColor *pixel) red=DecodesRGBGamma((double) pixel->red); green=DecodesRGBGamma((double) pixel->green); blue=DecodesRGBGamma((double) pixel->blue); - return(0.298839*red+0.586811*green+0.114350*blue); + return(0.298839f*red+0.586811f*green+0.114350f*blue); } #endif diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c index fb3c224ce..7584f3a3f 100644 --- a/MagickCore/xwindow.c +++ b/MagickCore/xwindow.c @@ -7701,7 +7701,7 @@ static inline double DiversityPixelIntensity( double intensity; - intensity=0.298839*pixel->red+0.586811*pixel->green+0.114350*pixel->blue; + intensity=0.298839f*pixel->red+0.586811f*pixel->green+0.114350f*pixel->blue; return(intensity); } diff --git a/PerlMagick/t/write.t b/PerlMagick/t/write.t index 3e201a0e7..707f83e84 100644 --- a/PerlMagick/t/write.t +++ b/PerlMagick/t/write.t @@ -37,7 +37,7 @@ testReadWrite( 'BMP:input.bmp', 'BMP:output.bmp', q//, '4db1c9f8cf10c1a9a7e80397b4cf060d2d31caae13ba712712e6341fb96bd6b0', - 'ae2007d0e05933a72294a6f8c7b59fc54d5fa3039f0f13bf8d65d05044ef2f39', + '5365605c69ea58eb07b9b043e3561f2aca5532e2f9054da1b7a80dc2aa515892', '5365605c69ea58eb07b9b043e3561f2aca5532e2f9054da1b7a80dc2aa515892'); print("Microsoft Windows 24-bit bitmap image file ...\n"); @@ -46,7 +46,7 @@ testReadWrite( 'BMP:input.bmp24', 'BMP:output.bmp24', q//, '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33', - '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33', + 'e7d406ec41fe69ba2bd88dd59e5eb17a83f17c0a99519def02c020041144f5b3', 'e7d406ec41fe69ba2bd88dd59e5eb17a83f17c0a99519def02c020041144f5b3'); print("ZSoft IBM PC multi-page Paintbrush file ...\n"); -- 2.40.0