]> granicus.if.org Git - imagemagick/blobdiff - coders/histogram.c
(no commit message)
[imagemagick] / coders / histogram.c
index 6adcad6ea945e6aa81478a5c7f5b3e99e649b380..4d2763592ba2097364c2adda5a8b0ffe8cc993c5 100644 (file)
@@ -180,9 +180,6 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
 {
 #define HistogramDensity  "256x200"
 
-  ChannelType
-    channel;
-
   char
     filename[MaxTextExtent];
 
@@ -246,7 +243,7 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
     &image->exception);
   if (histogram_image == (Image *) NULL)
     ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
-  (void) SetImageStorageClass(histogram_image,DirectClass);
+  (void) SetImageStorageClass(histogram_image,DirectClass,&image->exception);
   /*
     Allocate histogram count arrays.
   */
@@ -262,7 +259,6 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
   /*
     Initialize histogram count arrays.
   */
-  channel=image_info->channel;
   (void) ResetMagickMemory(histogram,0,length*sizeof(*histogram));
   for (y=0; y < (ssize_t) image->rows; y++)
   {
@@ -271,11 +267,11 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
       break;
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
+      if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
         histogram[ScaleQuantumToChar(GetPixelRed(image,p))].red++;
-      if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
+      if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
         histogram[ScaleQuantumToChar(GetPixelGreen(image,p))].green++;
-      if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
+      if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
         histogram[ScaleQuantumToChar(GetPixelBlue(image,p))].blue++;
       p+=GetPixelChannels(image);
     }
@@ -283,13 +279,13 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
   maximum=histogram[0].red;
   for (x=0; x < (ssize_t) histogram_image->columns; x++)
   {
-    if (((GetPixelRedTraits(image) & ActivePixelTrait) != 0) &&
+    if (((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) &&
         (maximum < histogram[x].red))
       maximum=histogram[x].red;
-    if (((GetPixelGreenTraits(image) & ActivePixelTrait) != 0) &&
+    if (((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) &&
         (maximum < histogram[x].green))
       maximum=histogram[x].green;
-    if (((GetPixelBlueTraits(image) & ActivePixelTrait) != 0) &&
+    if (((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) &&
         (maximum < histogram[x].blue))
       maximum=histogram[x].blue;
   }
@@ -306,7 +302,7 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
     q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception);
     if (q == (const Quantum *) NULL)
       break;
-    if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
+    if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
       {
         y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].red-0.5);
         r=q+y;
@@ -316,7 +312,7 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
           r++;
         }
       }
-    if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
+    if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
       {
         y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].green-0.5);
         r=q+y;
@@ -326,7 +322,7 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
           r++;
         }
       }
-    if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
+    if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
       {
         y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].blue-0.5);
         r=q+y;
@@ -388,7 +384,7 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
   if (LocaleCompare(write_info->magick,"HISTOGRAM") == 0)
     (void) FormatLocaleString(histogram_image->filename,MaxTextExtent,
       "miff:%s",write_info->filename);
-  status=WriteImage(write_info,histogram_image);
+  status=WriteImage(write_info,histogram_image,&image->exception);
   histogram_image=DestroyImage(histogram_image);
   write_info=DestroyImageInfo(write_info);
   return(status);