]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Mon, 14 May 2018 00:48:27 +0000 (20:48 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 14 May 2018 00:48:27 +0000 (20:48 -0400)
MagickCore/cache.c

index bee731a14694b7021887db8fad45d56e9b3d323e..81b8af70d607410e7b37424d5b2760124656edc1 100644 (file)
@@ -457,8 +457,9 @@ static MagickBooleanType ClipPixelCacheNexus(Image *image,
         PixelTrait traits = GetPixelChannelTraits(image,channel);
         if ((traits & UpdatePixelTrait) == 0)
           continue;
-        q[i]=MagickOver_(p[i],mask_alpha*GetPixelAlpha(image,p),q[i],
-          GetPixelAlpha(image,q));
+        q[i]=ClampToQuantum(MagickOver_((double) p[i],mask_alpha*
+          GetPixelAlpha(image,p),(double) q[i],(double)
+          GetPixelAlpha(image,q)));
       }
     p+=GetPixelChannels(image);
     q+=GetPixelChannels(image);
@@ -3390,7 +3391,7 @@ static inline Quantum ApplyPixelCompositeMask(const Quantum p,
     return(p);
   mask_alpha=1.0-QuantumScale*QuantumScale*alpha*beta;
   mask_alpha=PerceptibleReciprocal(mask_alpha);
-  return(mask_alpha*MagickOver_(p,alpha,q,beta));
+  return(ClampToQuantum(mask_alpha*MagickOver_((double) p,alpha,(double) q,beta)));
 }
 
 static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
@@ -3439,14 +3440,15 @@ static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
 
     if (p == (Quantum *) NULL)
       break;
-    mask_alpha=GetPixelCompositeMask(image,p);
+    mask_alpha=(double) GetPixelCompositeMask(image,p);
     for (i=0; i < (ssize_t) image->number_channels; i++)
     {
       PixelChannel channel = GetPixelChannelChannel(image,i);
       PixelTrait traits = GetPixelChannelTraits(image,channel);
       if ((traits & UpdatePixelTrait) == 0)
         continue;
-      q[i]=ApplyPixelCompositeMask(p[i],mask_alpha,q[i],GetPixelAlpha(image,q));
+      q[i]=ApplyPixelCompositeMask(p[i],mask_alpha,q[i],
+        (MagickRealType) GetPixelAlpha(image,q));
     }
     p+=GetPixelChannels(image);
     q+=GetPixelChannels(image);