From dafd287faca4c8cd5415d13185973add9c02b2c4 Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 24 Jul 2011 22:06:13 +0000 Subject: [PATCH] --- MagickCore/pixel.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 81f61e3c7..d4fc27032 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -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); } /* -- 2.40.0