]> granicus.if.org Git - imagemagick/blobdiff - coders/debug.c
...
[imagemagick] / coders / debug.c
index 08a0e8a2041b6897ed0da418a7e22f36338e8ffa..0bb4fc90152c01f87c96e6004f1f8e0c11d4cb54 100644 (file)
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
 %  obtain a copy of the License at                                            %
 %                                                                             %
-%    http://www.imagemagick.org/script/license.php                            %
+%    https://imagemagick.org/script/license.php                               %
 %                                                                             %
 %  Unless required by applicable law or agreed to in writing, software        %
 %  distributed under the License is distributed on an "AS IS" BASIS,          %
@@ -102,12 +102,10 @@ ModuleExport size_t RegisterDEBUGImage(void)
   MagickInfo
     *entry;
 
-  entry=SetMagickInfo("DEBUG");
+  entry=AcquireMagickInfo("DEBUG","DEBUG","Image pixel values for debugging");
   entry->encoder=(EncodeImageHandler *) WriteDEBUGImage;
-  entry->raw=MagickTrue;
-  entry->stealth=MagickTrue;
-  entry->description=ConstantString("Image pixel values for debugging");
-  entry->module=ConstantString("DEBUG");
+  entry->flags|=CoderRawSupportFlag;
+  entry->flags|=CoderStealthFlag;
   (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }
@@ -167,9 +165,9 @@ static MagickBooleanType WriteDEBUGImage(const ImageInfo *image_info,
   Image *image,ExceptionInfo *exception)
 {
   char
-    buffer[MaxTextExtent],
-    colorspace[MaxTextExtent],
-    tuple[MaxTextExtent];
+    buffer[MagickPathExtent],
+    colorspace[MagickPathExtent],
+    tuple[MagickPathExtent];
 
   ssize_t
     y;
@@ -189,28 +187,32 @@ static MagickBooleanType WriteDEBUGImage(const ImageInfo *image_info,
   register ssize_t
     x;
 
+  size_t
+    imageListLength;
+
   /*
     Open output image file.
   */
   assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
+  assert(image_info->signature == MagickCoreSignature);
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   status=OpenBlob(image_info,image,WriteBlobMode,exception);
   if (status == MagickFalse)
     return(status);
   scene=0;
+  imageListLength=GetImageListLength(image);
   do
   {
     (void) CopyMagickString(colorspace,CommandOptionToMnemonic(
-      MagickColorspaceOptions,(ssize_t) image->colorspace),MaxTextExtent);
+      MagickColorspaceOptions,(ssize_t) image->colorspace),MagickPathExtent);
     LocaleLower(colorspace);
     image->depth=GetImageQuantumDepth(image,MagickTrue);
     if (image->alpha_trait != UndefinedPixelTrait)
-      (void) ConcatenateMagickString(colorspace,"a",MaxTextExtent);
-    (void) FormatLocaleString(buffer,MaxTextExtent,
+      (void) ConcatenateMagickString(colorspace,"a",MagickPathExtent);
+    (void) FormatLocaleString(buffer,MagickPathExtent,
       "# ImageMagick pixel debugging: %.20g,%.20g,%.20g,%s\n",(double)
       image->columns,(double) image->rows,(double) ((MagickOffsetType)
       GetQuantumRange(image->depth)),colorspace);
@@ -223,29 +225,29 @@ static MagickBooleanType WriteDEBUGImage(const ImageInfo *image_info,
         break;
       for (x=0; x < (ssize_t) image->columns; x++)
       {
-        (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g: ",(double)
+        (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g,%.20g: ",(double)
           x,(double) y);
         (void) WriteBlobString(image,buffer);
         GetPixelInfoPixel(image,p,&pixel);
-        (void) FormatLocaleString(tuple,MaxTextExtent,"%.20g,%.20g,%.20g ",
+        (void) FormatLocaleString(tuple,MagickPathExtent,"%.20g,%.20g,%.20g ",
           (double) pixel.red,(double) pixel.green,(double) pixel.blue);
         if (pixel.colorspace == CMYKColorspace)
           {
             char
-              black[MaxTextExtent];
+              black[MagickPathExtent];
 
-            (void) FormatLocaleString(black,MaxTextExtent,",%.20g ",
+            (void) FormatLocaleString(black,MagickPathExtent,",%.20g ",
               (double) pixel.black);
-            (void) ConcatenateMagickString(tuple,black,MaxTextExtent);
+            (void) ConcatenateMagickString(tuple,black,MagickPathExtent);
           }
         if (pixel.alpha_trait != UndefinedPixelTrait)
           {
             char
-              alpha[MaxTextExtent];
+              alpha[MagickPathExtent];
 
-            (void) FormatLocaleString(alpha,MaxTextExtent,",%.20g ",
+            (void) FormatLocaleString(alpha,MagickPathExtent,",%.20g ",
               (double) pixel.alpha);
-            (void) ConcatenateMagickString(tuple,alpha,MaxTextExtent);
+            (void) ConcatenateMagickString(tuple,alpha,MagickPathExtent);
           }
         (void) WriteBlobString(image,tuple);
         (void) WriteBlobString(image,"\n");
@@ -259,8 +261,7 @@ static MagickBooleanType WriteDEBUGImage(const ImageInfo *image_info,
     if (GetNextImageInList(image) == (Image *) NULL)
       break;
     image=SyncNextImageInList(image);
-    status=SetImageProgress(image,SaveImagesTag,scene++,
-      GetImageListLength(image));
+    status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);
     if (status == MagickFalse)
       break;
   } while (image_info->adjoin != MagickFalse);