]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 24 Jul 2011 22:06:13 +0000 (22:06 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 24 Jul 2011 22:06:13 +0000 (22:06 +0000)
MagickCore/pixel.c

index 81f61e3c75bf47addcbbac6538fb3f6f1165ae2c..d4fc27032361562670ab2a601f27005c8cc43b48 100644 (file)
@@ -4533,22 +4533,16 @@ MagickExport void PushPixelChannelMap(Image *image,
 MagickExport void SetPixelChannelMap(Image *image,
   const ChannelType channel_mask)
 {
+#define GetChannelBit(alpha,i)  (((size_t) (alpha) >> (size_t) (i)) & 0x01)
+
   register ssize_t
     i;
 
-  for (i=0; i < MaxPixelChannels; i++)
+  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+    SetPixelChannelMapTraits(image,(PixelChannel) i,
+      GetChannelBit(channel_mask,i) ? UpdatePixelTrait : CopyPixelTrait);
+  for ( ; i < MaxPixelChannels; i++)
     SetPixelChannelMapTraits(image,(PixelChannel) i,UndefinedPixelTrait);
-  image->sync=(channel_mask & SyncChannels) != 0 ? MagickTrue : MagickFalse;
-  if ((channel_mask & RedChannel) != 0)
-    SetPixelRedTraits(image,UpdatePixelTrait);
-  if ((channel_mask & GreenChannel) != 0)
-    SetPixelGreenTraits(image,UpdatePixelTrait);
-  if ((channel_mask & BlueChannel) != 0)
-    SetPixelBlueTraits(image,UpdatePixelTrait);
-  if ((channel_mask & BlackChannel) != 0)
-    SetPixelBlackTraits(image,UpdatePixelTrait);
-  if ((channel_mask & AlphaChannel) != 0)
-    SetPixelAlphaTraits(image,UpdatePixelTrait);
 }
 \f
 /*