]> granicus.if.org Git - imagemagick/commitdiff
Magick.NET unit tests no longer fails
authorCristy <urban-warrior@imagemagick.org>
Thu, 27 Jun 2019 14:28:26 +0000 (10:28 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 27 Jun 2019 14:28:26 +0000 (10:28 -0400)
MagickCore/composite.c

index 203e7ab9fda019dbe39442cde0aa3ff8b3080c73..78e1ff222aab5a3d758fcaf952576cc9e8aa9447 100644 (file)
@@ -611,6 +611,9 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
         break;
       if ((y_offset+(ssize_t) source_image->rows) > (ssize_t) image->rows)
         break;
+      if ((source_image->alpha_trait == UndefinedPixelTrait) &&
+          (image->alpha_trait != UndefinedPixelTrait))
+        (void) SetImageAlphaChannel(source_image,OpaqueAlphaChannel,exception);
       status=MagickTrue;
       source_view=AcquireVirtualCacheView(source_image,exception);
       image_view=AcquireAuthenticCacheView(image,exception);
@@ -660,13 +663,10 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
             PixelTrait source_traits = GetPixelChannelTraits(source_image,
               channel);
             PixelTrait traits = GetPixelChannelTraits(image,channel);
-            if (traits == UndefinedPixelTrait)
+            if ((source_traits == UndefinedPixelTrait) ||
+                (traits == UndefinedPixelTrait))
               continue;
-            if (source_traits != UndefinedPixelTrait)
-              SetPixelChannel(image,channel,p[i],q);
-            else
-              if (channel == AlphaPixelChannel)
-                SetPixelChannel(image,channel,OpaqueAlpha,q);
+            SetPixelChannel(image,channel,p[i],q);
           }
           p+=GetPixelChannels(source_image);
           q+=GetPixelChannels(image);