From 6809406b50272061280767c9749f453420a68b15 Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 22 Aug 2014 12:59:44 +0000 Subject: [PATCH] --- MagickCore/compare.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/MagickCore/compare.c b/MagickCore/compare.c index b6d37cf0c..c4e903bdc 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -105,14 +105,33 @@ % */ +static size_t GetImageChannels(const Image *image) +{ + register ssize_t + i; + + size_t + channels; + + channels=0; + for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + { + PixelChannel channel=GetPixelChannelChannel(image,i); + PixelTrait traits=GetPixelChannelTraits(image,channel); + if ((traits & UpdatePixelTrait) != 0) + channels++; + } + return(channels == 0 ? 1 : channels); +} + static inline MagickBooleanType ValidateImageMorphology( const Image *restrict image,const Image *restrict reconstruct_image) { /* Does the image match the reconstructed image morphology? - if (image->number_channels != reconstruct_image->number_channels) - return(MagickFalse); */ + if (GetImageChannels(image) != GetImageChannels(reconstruct_image)) + return(MagickFalse); return(MagickTrue); } @@ -448,25 +467,6 @@ static MagickBooleanType GetAbsoluteDistortion(const Image *image, return(status); } -static size_t GetImageChannels(const Image *image) -{ - register ssize_t - i; - - size_t - channels; - - channels=0; - for (i=0; i < (ssize_t) GetPixelChannels(image); i++) - { - PixelChannel channel=GetPixelChannelChannel(image,i); - PixelTrait traits=GetPixelChannelTraits(image,channel); - if ((traits & UpdatePixelTrait) != 0) - channels++; - } - return(channels == 0 ? 1 : channels); -} - static MagickBooleanType GetFuzzDistortion(const Image *image, const Image *reconstruct_image,double *distortion,ExceptionInfo *exception) { -- 2.40.0