From f0e5dc9d360bc60ac8c1b5e4fd60f27cc1b0e543 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 21 Nov 2015 12:35:35 +0100 Subject: [PATCH] Added missing check for destination transparency. --- MagickCore/pixel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 3fb410848..91e62942a 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -6042,7 +6042,8 @@ MagickExport MagickBooleanType IsFuzzyEquivalencePixel(const Image *source, fuzz=GetFuzzyColorDistance(source,destination); scale=1.0; distance=0.0; - if (source->alpha_trait != UndefinedPixelTrait) + if (source->alpha_trait != UndefinedPixelTrait || + destination->alpha_trait != UndefinedPixelTrait) { /* Transparencies are involved - set alpha distance @@ -6055,8 +6056,10 @@ MagickExport MagickBooleanType IsFuzzyEquivalencePixel(const Image *source, Generate a alpha scaling factor to generate a 4D cone on colorspace Note that if one color is transparent, distance has no color component. */ - scale=QuantumScale*GetPixelAlpha(source,p); - scale*=QuantumScale*GetPixelAlpha(destination,q); + if (source->alpha_trait != UndefinedPixelTrait) + scale=QuantumScale*GetPixelAlpha(source,p); + if (destination->alpha_trait != UndefinedPixelTrait) + scale*=QuantumScale*GetPixelAlpha(destination,q); if (scale <= MagickEpsilon) return(MagickTrue); } -- 2.40.0