]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 21 May 2011 21:33:06 +0000 (21:33 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 21 May 2011 21:33:06 +0000 (21:33 +0000)
14 files changed:
coders/gif.c
coders/jbig.c
coders/jpeg.c
coders/map.c
coders/palm.c
coders/psd.c
coders/wpg.c
coders/xwd.c
magick/colormap.c
magick/compress.c
magick/deprecate.c
magick/quantize.c
magick/quantum-import.c
magick/threshold.c

index 9442ef869836e20a22d04d0838d4bd741db06513..2453568d2f3c5b0037ea84ef906a4b329f36c7d6 100644 (file)
@@ -446,9 +446,7 @@ static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)
         break;
       index=ConstrainColormapIndex(image,(size_t) c);
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
       SetOpacityPixelComponent(q,(ssize_t) index == opacity ?
         TransparentOpacity : OpaqueOpacity);
       x++;
index 96185f52d0c7c7c1f4b88fc32275db2120be47bd..3a0b5a0f2875e482c57901cdcde2bfceda287157 100644 (file)
@@ -238,9 +238,7 @@ static Image *ReadJBIGImage(const ImageInfo *image_info,
       if (bit == 8)
         bit=0;
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
       q++;
     }
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
index 4ab629cfd7311a00926f8951c4f6ff8adfa121db..25e636bc1b35f4fb0f2e705e18d01a668f216f0c 100644 (file)
@@ -1249,9 +1249,7 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
               pixel=(size_t) ((GETJSAMPLE(*p) ^ 0x80) << 4);
             index=ConstrainColormapIndex(image,pixel);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(int) index].red);
-            SetGreenPixelComponent(q,image->colormap[(int) index].green);
-            SetBluePixelComponent(q,image->colormap[(int) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             p++;
             q++;
           }
@@ -1289,9 +1287,7 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
         {
           index=ConstrainColormapIndex(image,(size_t) GETJSAMPLE(*p));
           SetIndexPixelComponent(indexes+x,index);
-          SetRedPixelComponent(q,image->colormap[(int) index].red);
-          SetGreenPixelComponent(q,image->colormap[(int) index].green);
-          SetBluePixelComponent(q,image->colormap[(int) index].blue);
+          SetRGBOPixelComponent(q,image->colormap+index);
           p++;
           q++;
         }
index 0a5593fb96eb07d81ff3346c13c34fd3f4f915ac..dc21b7bc216b36e4191e583c44b2fc8fc1522e27 100644 (file)
@@ -228,9 +228,7 @@ static Image *ReadMAPImage(const ImageInfo *image_info,ExceptionInfo *exception)
           p++;
         }
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
     }
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
index faaa06f1a044c0b1f9e391f19a405043b6240bf0..439d73e8576f3ad40ec6bffae92d3521b8446113 100644 (file)
@@ -494,9 +494,7 @@ static Image *ReadPALMImage(const ImageInfo *image_info,
               ThrowReaderException(CorruptImageError,"CorruptImage");
             index=(IndexPacket) (mask-(((*ptr) & (mask << bit)) >> bit));
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             if (bit)
               bit-=bits_per_pixel;
             else
index da2b0a7d6fb188ea3cb43a156174ee909a5314cf..9739045b2531a93c1834a2778b08bc9627e5bc15 100644 (file)
@@ -653,12 +653,8 @@ static MagickBooleanType ReadPSDLayer(Image *image,const size_t channels,
                 SetIndexPixelComponent(indexes+x,ScaleQuantumToChar(pixel));
               else
                 SetIndexPixelComponent(indexes+x,ScaleQuantumToShort(pixel));
-              SetRedPixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x)].red);
-              SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x)].green);
-              SetBluePixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x)].blue);
+              SetRGBOPixelComponent(q,image->colormap+
+                GetIndexPixelComponent(indexes+x));
               if (image->depth == 1)
                 {
                   ssize_t
@@ -672,12 +668,8 @@ static MagickBooleanType ReadPSDLayer(Image *image,const size_t channels,
                   {
                     SetIndexPixelComponent(indexes+x,(((unsigned char) pixel) &
                       (0x01 << (7-bit))) != 0 ? 0 : 255);
-                    SetRedPixelComponent(q,image->colormap[(ssize_t)
-                      GetIndexPixelComponent(indexes+x)].red);
-                    SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                      GetIndexPixelComponent(indexes+x)].green);
-                    SetBluePixelComponent(q,image->colormap[(ssize_t)
-                      GetIndexPixelComponent(indexes+x)].blue);
+                    SetRGBOPixelComponent(q,image->colormap+
+                      GetIndexPixelComponent(indexes+x));
                     q++;
                     x++;
                   }
index ffd8fe8b5c6eff554f6c30272461becfb243d2d8..d140a712e29b4a4f78bb9de8d6d5c70f2c95bccf 100644 (file)
@@ -297,9 +297,7 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
               {
                 index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
                 SetIndexPixelComponent(indexes+x+bit,index);
-                SetRedPixelComponent(q,image->colormap[(int) index].red);
-                SetGreenPixelComponent(q,image->colormap[(int) index].green);
-                SetBluePixelComponent(q,image->colormap[(int) index].blue);
+                SetRGBOPixelComponent(q,image->colormap+index);
                 q++;
               }
             p++;
@@ -310,9 +308,7 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
               {
                 index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
                 SetIndexPixelComponent(indexes+x+bit,index);
-                SetRedPixelComponent(q,image->colormap[(int) index].red);
-                SetGreenPixelComponent(q,image->colormap[(int) index].green);
-                SetBluePixelComponent(q,image->colormap[(int) index].blue);
+                SetRGBOPixelComponent(q,image->colormap+index);
                 q++;
               }
             p++;
@@ -331,27 +327,19 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
         {
             index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
             index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
             index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
             index=ConstrainColormapIndex(image,(*p) & 0x3);
             SetIndexPixelComponent(indexes+x+1,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             p++;
             q++;
         }
@@ -359,31 +347,21 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
           {
             index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
             if ((image->columns % 4) >= 1)
 
               {
                 index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
                 SetIndexPixelComponent(indexes+x,index);
-                SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-                SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                  index].green);
-                SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+                SetRGBOPixelComponent(q,image->colormap+index);
                 q++;
                 if ((image->columns % 4) >= 2)
 
                   {
                     index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
                     SetIndexPixelComponent(indexes+x,index);
-                    SetRedPixelComponent(q,image->colormap[(ssize_t)
-                      index].red);
-                    SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                      index].green);
-                    SetBluePixelComponent(q,image->colormap[(ssize_t)
-                      index].blue);
+                    SetRGBOPixelComponent(q,image->colormap+index);
                     q++;
                   }
               }
@@ -404,15 +382,11 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
           { 
             index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
             index=ConstrainColormapIndex(image,(*p) & 0x0f);
             SetIndexPixelComponent(indexes+x+1,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             p++;
             q++;
           }
@@ -420,9 +394,7 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
           {
             index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             p++;
             q++;
           }
@@ -440,9 +412,7 @@ static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
           {
             index=ConstrainColormapIndex(image,*p);
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             p++;
             q++;
           }
index 5d2ec6d802711e839c0ecd87196ff5c49295a578..0ad00e3dd153729865ebac366c1f31a0bfc1db85 100644 (file)
@@ -478,9 +478,7 @@ static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception)
             index=ConstrainColormapIndex(image,XGetPixel(ximage,(int) x,
               (int) y));
             SetIndexPixelComponent(indexes+x,index);
-            SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+            SetRGBOPixelComponent(q,image->colormap+index);
             q++;
           }
           if (SyncAuthenticPixels(image,exception) == MagickFalse)
index 1b6247e894e89b945697f4dc057a2f4d65163285..1955fd80a4479d553a56a2becd435628323c901b 100644 (file)
@@ -237,9 +237,7 @@ MagickExport MagickBooleanType CycleColormapImage(Image *image,
       if (index < 0)
         index+=(ssize_t) image->colors;
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[index].red);
-      SetGreenPixelComponent(q,image->colormap[index].green);
-      SetBluePixelComponent(q,image->colormap[index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
       q++;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -380,9 +378,7 @@ MagickExport MagickBooleanType SortColormapByIntensity(Image *image)
     {
       index=(IndexPacket) pixels[(ssize_t) GetIndexPixelComponent(indexes+x)];
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
       status=MagickFalse;
index 1cde7f5eddcaece2353bbdaa0c9c03c29f5ac15d..571ac961811ed2a25c3b19ccfa25f498ad5cb887 100644 (file)
@@ -638,9 +638,7 @@ MagickExport MagickBooleanType HuffmanDecodeImage(Image *image)
     {
       index=(IndexPacket) (*p++);
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
       break;
index 703ded2724a8fb1c0655725d0cd470c99875861c..7104315035698f6d0a35fb63b49c8ed38f1b52b7 100644 (file)
@@ -5554,9 +5554,7 @@ MagickExport unsigned int RandomChannelThresholdImage(Image *image,const char
             threshold=(MagickRealType) QuantumRange*o4[(x%4)+4*(y%4)];
           index=(IndexPacket) (intensity <= threshold ? 0 : 1);
           SetIndexPixelComponent(indexes+x,index);
-          SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-          SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-          SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+          SetRGBOPixelComponent(q,image->colormap+index);
           q++;
         }
       }
@@ -6623,9 +6621,7 @@ MagickExport unsigned int ThresholdImage(Image *image,const double threshold)
       index=(IndexPacket) ((MagickRealType) PixelIntensityToQuantum(q) <=
         threshold ? 0 : 1);
       SetIndexPixelComponent(indexes+x,index);
-      SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-      SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-      SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+      SetRGBOPixelComponent(q,image->colormap+index);
       q++;
     }
     if (!SyncAuthenticPixels(image,&image->exception))
index 685466521921a81f5b05e8740c37bec5a4942a02..64d5e0755f69d62c01d8eba98393be81fc490f13 100644 (file)
@@ -610,9 +610,7 @@ static MagickBooleanType AssignImageColors(Image *image,CubeInfo *cube_info)
               SetIndexPixelComponent(indexes+x+i,index);
             if (cube.quantize_info->measure_error == MagickFalse)
               {
-                SetRedPixelComponent(q,image->colormap[index].red);
-                SetGreenPixelComponent(q,image->colormap[index].green);
-                SetBluePixelComponent(q,image->colormap[index].blue);
+                SetRGBPixelComponent(q,image->colormap+index);
                 if (cube.associate_alpha != MagickFalse)
                   SetOpacityPixelComponent(q,image->colormap[index].opacity);
               }
@@ -1600,9 +1598,7 @@ static MagickBooleanType FloydSteinbergDither(Image *image,CubeInfo *cube_info)
         SetIndexPixelComponent(indexes+u,index);
       if (cube.quantize_info->measure_error == MagickFalse)
         {
-          SetRedPixelComponent(q+u,image->colormap[index].red);
-          SetGreenPixelComponent(q+u,image->colormap[index].green);
-          SetBluePixelComponent(q+u,image->colormap[index].blue);
+          SetRGBPixelComponent(q,image->colormap+index);
           if (cube.associate_alpha != MagickFalse)
             SetOpacityPixelComponent(q+u,image->colormap[index].opacity);
         }
@@ -1823,9 +1819,7 @@ static MagickBooleanType RiemersmaDither(Image *image,CacheView *image_view,
         *indexes=(IndexPacket) index;
       if (cube_info->quantize_info->measure_error == MagickFalse)
         {
-          SetRedPixelComponent(q,image->colormap[index].red);
-          SetGreenPixelComponent(q,image->colormap[index].green);
-          SetBluePixelComponent(q,image->colormap[index].blue);
+          SetRGBPixelComponent(q,image->colormap+index);
           if (cube_info->associate_alpha != MagickFalse)
             SetOpacityPixelComponent(q,image->colormap[index].opacity);
         }
index 4ce53fd36fba7a2c7a1512f7b53bb776e6516394..8af104837b5e41db44b9f26e2e141b10b469c252 100644 (file)
@@ -346,12 +346,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
                   0x00 : 0x01);
               SetIndexPixelComponent(indexes+x+bit,PushColormapIndex(image,
                 pixel,&range_exception));
-              SetRedPixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x+bit)].red);
-              SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x+bit)].green);
-              SetBluePixelComponent(q,image->colormap[(ssize_t)
-                GetIndexPixelComponent(indexes+x+bit)].blue);
+              SetRGBOPixelComponent(q,image->colormap+
+                GetIndexPixelComponent(indexes+x+bit));
               q++;
             }
             p++;
@@ -366,12 +362,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
                 0x00 : 0x01);
             SetIndexPixelComponent(indexes+x+bit,PushColormapIndex(image,pixel,
               &range_exception));
-            SetRedPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].blue);
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x+bit));
             q++;
           }
           break;
@@ -386,12 +378,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             pixel=(unsigned char) ((*p >> 4) & 0xf);
             SetIndexPixelComponent(indexes+x,PushColormapIndex(image,pixel,
               &range_exception));
-            SetRedPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].blue);
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x));
             q++;
             pixel=(unsigned char) ((*p) & 0xf);
             SetIndexPixelComponent(indexes+x+1,PushColormapIndex(image,pixel,
@@ -405,12 +393,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             pixel=(unsigned char) ((*p++ >> 4) & 0xf);
             SetIndexPixelComponent(indexes+x+bit,PushColormapIndex(image,pixel,
               &range_exception));
-            SetRedPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x+bit)].blue);
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x+bit));
             q++;
           }
           break;
@@ -425,12 +409,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             p=PushCharPixel(p,&pixel);
             SetIndexPixelComponent(indexes+x,PushColormapIndex(image,pixel,
               &range_exception));
-            SetRedPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].blue);
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x));
             p+=quantum_info->pad;
             q++;
           }
@@ -449,12 +429,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
                 SetIndexPixelComponent(indexes+x,PushColormapIndex(image,
                   ClampToQuantum((MagickRealType) QuantumRange*
                   HalfToSinglePrecision(pixel)),&range_exception));
-                SetRedPixelComponent(q,image->colormap[(ssize_t)
-                  GetIndexPixelComponent(indexes+x)].red);
-                SetGreenPixelComponent(q,image->colormap[(ssize_t)
-                  GetIndexPixelComponent(indexes+x)].green);
-                SetBluePixelComponent(q,image->colormap[(ssize_t)
-                  GetIndexPixelComponent(indexes+x)].blue);
+                SetRGBOPixelComponent(q,image->colormap+
+                  GetIndexPixelComponent(indexes+x));
                 p+=quantum_info->pad;
                 q++;
               }
@@ -465,12 +441,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             p=PushShortPixel(endian,p,&pixel);
             SetIndexPixelComponent(indexes+x,PushColormapIndex(image,pixel,
               &range_exception));
-            SetRedPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].red);
-            SetGreenPixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].green);
-            SetBluePixelComponent(q,image->colormap[(ssize_t)
-              GetIndexPixelComponent(indexes+x)].blue);
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x));
             p+=quantum_info->pad;
             q++;
           }
@@ -491,7 +463,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
                 p=PushFloatPixel(&quantum_state,p,&pixel);
                 SetIndexPixelComponent(indexes+x,PushColormapIndex(image,
                   ClampToQuantum(pixel),&range_exception));
-                *q=image->colormap[(ssize_t) GetIndexPixelComponent(indexes+x)];
+                SetRGBOPixelComponent(q,image->colormap+
+                  GetIndexPixelComponent(indexes+x));
                 p+=quantum_info->pad;
                 q++;
               }
@@ -502,7 +475,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             p=PushLongPixel(endian,p,&pixel);
             SetIndexPixelComponent(indexes+x,PushColormapIndex(image,pixel,
               &range_exception));
-            *q=image->colormap[(ssize_t) GetIndexPixelComponent(indexes+x)];
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x));
             p+=quantum_info->pad;
             q++;
           }
@@ -520,7 +494,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
                 p=PushDoublePixel(&quantum_state,p,&pixel);
                 SetIndexPixelComponent(indexes+x,PushColormapIndex(image,
                   ClampToQuantum(pixel),&range_exception));
-                *q=image->colormap[(ssize_t) GetIndexPixelComponent(indexes+x)];
+                SetRGBOPixelComponent(q,image->colormap+
+                  GetIndexPixelComponent(indexes+x));
                 p+=quantum_info->pad;
                 q++;
               }
@@ -534,7 +509,8 @@ MagickExport size_t ImportQuantumPixels(Image *image,CacheView *image_view,
             p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
             SetIndexPixelComponent(indexes+x,PushColormapIndex(image,pixel,
               &range_exception));
-            *q=image->colormap[(ssize_t) GetIndexPixelComponent(indexes+x)];
+            SetRGBOPixelComponent(q,image->colormap+
+              GetIndexPixelComponent(indexes+x));
             p+=quantum_info->pad;
             q++;
           }
index 10fe872916a98c2bb3da1849b48a98a96e6b8028..d3f49c2b493be57fd9ceb9e7c7463887848cd57b 100644 (file)
@@ -1779,9 +1779,7 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
               GetPseudoRandomValue(random_info[id]));
           index=(IndexPacket) (intensity <= threshold.index ? 0 : 1);
           SetIndexPixelComponent(indexes+x,index);
-          SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
-          SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
-          SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+          SetRGBOPixelComponent(q,image->colormap+index);
           q++;
         }
         sync=SyncCacheViewAuthenticPixels(image_view,exception);