From: cristy Date: Sat, 28 Jul 2012 00:33:10 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5238 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a865ccd68cbccfdf00a5fdd40bc491c5f5390303;p=imagemagick --- diff --git a/MagickCore/composite.c b/MagickCore/composite.c index ec602f432..0ad7b8349 100644 --- a/MagickCore/composite.c +++ b/MagickCore/composite.c @@ -533,7 +533,7 @@ static MagickBooleanType CompositeOverImage(Image *image, } MagickExport MagickBooleanType CompositeImage(Image *image, - const Image *composite_image,const CompositeOperator compose, + const Image *composite,const CompositeOperator compose, const MagickBooleanType clip_to_self,const ssize_t x_offset, const ssize_t y_offset,ExceptionInfo *exception) { @@ -547,6 +547,7 @@ MagickExport MagickBooleanType CompositeImage(Image *image, geometry_info; Image + *composite_image, *destination_image; MagickBooleanType @@ -574,22 +575,19 @@ MagickExport MagickBooleanType CompositeImage(Image *image, assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - assert(composite_image != (Image *) NULL); - assert(composite_image->signature == MagickSignature); + assert(composite!= (Image *) NULL); + assert(composite->signature == MagickSignature); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); - if (IsGrayColorspace(image->colorspace) != MagickFalse) - { - if (IsGrayColorspace(composite_image->colorspace) != MagickFalse) - (void) SetImageColorspace(image,RGBColorspace,exception); - else - (void) TransformImageColorspace(image,composite_image->colorspace, - exception); - } + composite_image=CloneImage(composite,0,0,MagickTrue,exception); + if (composite_image == (const Image *) NULL) + return(MagickFalse); + (void) TransformImageColorspace(composite_image,image->colorspace,exception); if ((compose == OverCompositeOp) || (compose == SrcOverCompositeOp)) { status=CompositeOverImage(image,composite_image,clip_to_self,x_offset, y_offset,exception); + composite_image=DestroyImage(composite_image); return(status); } destination_image=(Image *) NULL; @@ -2305,6 +2303,7 @@ MagickExport MagickBooleanType CompositeImage(Image *image, image_view=DestroyCacheView(image_view); if (destination_image != (Image * ) NULL) destination_image=DestroyImage(destination_image); + composite_image=DestroyImage(composite_image); return(status); } @@ -2363,8 +2362,7 @@ MagickExport MagickBooleanType TextureImage(Image *image,const Image *texture, texture_image=CloneImage(texture,0,0,MagickTrue,exception); if (texture_image == (const Image *) NULL) return(MagickFalse); - if (IsGrayColorspace(texture_image->colorspace) != MagickFalse) - (void) TransformImageColorspace(texture_image,RGBColorspace,exception); + (void) TransformImageColorspace(texture_image,image->colorspace,exception); (void) SetImageVirtualPixelMethod(texture_image,TileVirtualPixelMethod, exception); status=MagickTrue; diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index 36610aa59..bbc57fcb8 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -74,7 +74,7 @@ static inline Quantum GetPixelBlack(const Image *restrict image, const Quantum *restrict pixel) { if (image->channel_map[BlackPixelChannel].traits == UndefinedPixelTrait) - return(0); + return((Quantum) 0); return(pixel[image->channel_map[BlackPixelChannel].offset]); } @@ -109,7 +109,7 @@ static inline Quantum GetPixelChannel(const Image *restrict image, const PixelChannel channel,const Quantum *restrict pixel) { if (image->channel_map[channel].traits == UndefinedPixelTrait) - return(0); + return((Quantum) 0); return(pixel[image->channel_map[channel].offset]); } @@ -184,7 +184,7 @@ static inline Quantum GetPixelIndex(const Image *restrict image, const Quantum *restrict pixel) { if (image->channel_map[IndexPixelChannel].traits == UndefinedPixelTrait) - return(0); + return((Quantum) 0); return(pixel[image->channel_map[IndexPixelChannel].offset]); } @@ -313,7 +313,7 @@ static inline Quantum GetPixelMask(const Image *restrict image, const Quantum *restrict pixel) { if (image->channel_map[MaskPixelChannel].traits == UndefinedPixelTrait) - return(0); + return((Quantum) 0); return(pixel[image->channel_map[MaskPixelChannel].offset]); } diff --git a/coders/dcm.c b/coders/dcm.c index a61c11ac3..7d7594ccb 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -40,7 +40,7 @@ Include declarations. */ #include "MagickCore/studio.h" -#include "MagickCore/property.h" +#include "MagickCore/attribute.h" #include "MagickCore/blob.h" #include "MagickCore/blob-private.h" #include "MagickCore/cache.h" @@ -61,6 +61,7 @@ #include "MagickCore/monitor-private.h" #include "MagickCore/option.h" #include "MagickCore/pixel-accessor.h" +#include "MagickCore/property.h" #include "MagickCore/resource_.h" #include "MagickCore/quantum-private.h" #include "MagickCore/static.h" @@ -3638,6 +3639,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) image->columns=(size_t) width; image->rows=(size_t) height; image->depth=depth; + image->colorspace=RGBColorspace; if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1)) { size_t @@ -4053,6 +4055,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) } } } + if (IsImageGray(image,exception) != MagickFalse) + (void) SetImageColorspace(image,GRAYColorspace,exception); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", diff --git a/coders/png.c b/coders/png.c index b582236b2..d167161e2 100644 --- a/coders/png.c +++ b/coders/png.c @@ -1808,7 +1808,11 @@ static void MagickPNGWarningHandler(png_struct *ping,png_const_charp message) } #ifdef PNG_USER_MEM_SUPPORTED -static png_voidp Magick_png_malloc(png_structp png_ptr,png_uint_32 size) +#if PNG_LIBPNG_VER >= 14000 +static png_voidp Magick_png_malloc(png_structp png_ptr,png_alloc_size_t size) +#else +static png_voidp Magick_png_malloc(png_structp png_ptr,png_size_t size) +#endif { (void) png_ptr; return((png_voidp) AcquireMagickMemory((size_t) size)); @@ -7458,12 +7462,22 @@ Magick_png_write_raw_profile(const ImageInfo *image_info,png_struct *ping, (char *) profile_type, (double) length); } - text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text)); +#if PNG_LIBPNG_VER >= 14000 + text=(png_textp) png_malloc(ping,(png_alloc_size_t) sizeof(png_text)); +#else + text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text)); +#endif description_length=(png_uint_32) strlen((const char *) profile_description); allocated_length=(png_uint_32) (length*2 + (length >> 5) + 20 + description_length); - text[0].text=(png_charp) png_malloc(ping,allocated_length); - text[0].key=(png_charp) png_malloc(ping, (png_uint_32) 80); +#if PNG_LIBPNG_VER >= 14000 + text[0].text=(png_charp) png_malloc(ping, + (png_alloc_size_t) allocated_length); + text[0].key=(png_charp) png_malloc(ping, (png_alloc_size_t) 80); +#else + text[0].text=(png_charp) png_malloc(ping, (png_size_t) allocated_length); + text[0].key=(png_charp) png_malloc(ping, (png_size_t) 80); +#endif text[0].key[0]='\0'; (void) ConcatenateMagickString(text[0].key, "Raw profile type ",MaxTextExtent); @@ -10782,7 +10796,13 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, { if (value != (const char *) NULL) { - text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text)); + +#if PNG_LIBPNG_VER >= 14000 + text=(png_textp) png_malloc(ping, + (png_alloc_size_t) sizeof(png_text)); +#else + text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text)); +#endif text[0].key=(char *) property; text[0].text=(char *) value; text[0].text_length=strlen(value); diff --git a/coders/svg.c b/coders/svg.c index 8f741be64..cd08349d7 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -2938,7 +2938,7 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception) double gamma; - gamma=1.0-QuantumScale*fill_color.alpha; + gamma=QuantumScale*fill_color.alpha; gamma=MagickEpsilonReciprocal(gamma); fill_color.blue*=gamma; fill_color.green*=gamma;