From 9c450d8fcc39de0a37f20ff23c79f358719ff433 Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 27 May 2014 00:29:31 +0000 Subject: [PATCH] --- MagickCore/cache.c | 3 +-- MagickCore/morphology.c | 3 ++- MagickCore/pixel-accessor.h | 10 ++++++++-- MagickCore/statistic.c | 2 +- MagickWand/pixel-wand.c | 1 + coders/label.c | 1 + 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/MagickCore/cache.c b/MagickCore/cache.c index 9a7d559d6..024fe5e11 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -693,8 +693,7 @@ static MagickBooleanType ClonePixelCacheRepository( if ((clone_nexus[id]->metacontent != (void *) NULL) && (cache_nexus[id]->metacontent != (void *) NULL)) (void) memcpy(clone_nexus[id]->metacontent, - cache_nexus[id]->metacontent,length* - sizeof(cache_nexus[id]->metacontent)); + cache_nexus[id]->metacontent,length*sizeof(unsigned char)); status=WritePixelCacheMetacontent(clone_info,clone_nexus[id],exception); } } diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c index c8859fcda..51aed6b0e 100644 --- a/MagickCore/morphology.c +++ b/MagickCore/morphology.c @@ -2769,7 +2769,8 @@ static ssize_t MorphologyPrimitive(const Image *image,Image *morphology_image, if (fabs(pixel-p[center+i]) > MagickEpsilon) changes[id]++; gamma=PerceptibleReciprocal(gamma); - gamma*=(double) kernel->height*kernel->width/count; + if (count != 0) + gamma*=(double) kernel->height*kernel->width/count; SetPixelChannel(morphology_image,channel,ClampToQuantum(gamma* pixel),q); } diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index d6054083e..b18d24171 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -341,6 +341,8 @@ 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->colorspace=image->colorspace; + pixel_info->fuzz=image->fuzz; pixel_info->red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset]; pixel_info->green=(MagickRealType) @@ -352,9 +354,13 @@ static inline void GetPixelInfoPixel(const Image *restrict image, pixel_info->black=(MagickRealType) pixel[image->channel_map[BlackPixelChannel].offset]; pixel_info->alpha=(MagickRealType) OpaqueAlpha; + pixel_info->alpha_trait=MagickFalse; if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) - pixel_info->alpha=(MagickRealType) - pixel[image->channel_map[AlphaPixelChannel].offset]; + { + pixel_info->alpha=(MagickRealType) + pixel[image->channel_map[AlphaPixelChannel].offset]; + pixel_info->alpha_trait=MagickTrue; + } pixel_info->index=0.0f; if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait) pixel_info->index=(MagickRealType) diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index 42ea5facb..20537a795 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -1912,7 +1912,7 @@ static size_t GetImageChannels(const Image *image) if (traits != UndefinedPixelTrait) channels++; } - return(channels); + return(channels == 0 ? 1 : channels); } MagickExport ChannelStatistics *GetImageStatistics(const Image *image, diff --git a/MagickWand/pixel-wand.c b/MagickWand/pixel-wand.c index cdb42733b..d8dfa1b4a 100644 --- a/MagickWand/pixel-wand.c +++ b/MagickWand/pixel-wand.c @@ -1262,6 +1262,7 @@ WandExport void PixelGetQuantumPacket(const PixelWand *wand,PixelInfo *packet) if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); assert(packet != (PixelInfo *) NULL); + packet->fuzz=wand->pixel.fuzz; packet->alpha=(double) ClampToQuantum(wand->pixel.alpha); packet->alpha_trait=wand->pixel.alpha_trait; if (wand->pixel.colorspace == CMYKColorspace) diff --git a/coders/label.c b/coders/label.c index 0e2162e8e..67f0434a1 100644 --- a/coders/label.c +++ b/coders/label.c @@ -132,6 +132,7 @@ static Image *ReadLABELImage(const ImageInfo *image_info, draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); draw_info->text=ConstantString(label); metrics.width=0; + metrics.ascent=0.0; status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception); if ((image->columns == 0) && (image->rows == 0)) { -- 2.50.1