]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 13 Nov 2012 01:14:41 +0000 (01:14 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 13 Nov 2012 01:14:41 +0000 (01:14 +0000)
MagickCore/statistic.c
MagickWand/mogrify.c
MagickWand/operation.c

index 08d2e9400a33c1159465831ac02d53e1f15e04c3..5689dde29e3995b5e730d1df0c0f883b0e4a347d 100644 (file)
@@ -1868,6 +1868,8 @@ MagickExport Image *PolynomialImage(const Image *images,
       register const Quantum
         *p;
 
+      if (j >= (ssize_t) number_terms)
+        continue;
       image_view=AcquireVirtualCacheView(next,exception);
       p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
       if (p == (const Quantum *) NULL)
@@ -1898,8 +1900,6 @@ MagickExport Image *PolynomialImage(const Image *images,
             polynomial_traits,
             traits;
 
-          if ((i >> 1) >= (ssize_t) number_terms)
-            continue;
           channel=GetPixelChannelChannel(image,i);
           traits=GetPixelChannelTraits(next,channel);
           polynomial_traits=GetPixelChannelTraits(image,channel);
index 8896753bad12c02a6a264c0e620337d065079d12..f8fb1df2d2152b96b81d04b0216aa853116528c2 100644 (file)
@@ -2294,60 +2294,6 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               interpolate_method,exception);
             break;
           }
-        if (LocaleCompare("poly",option+1) == 0)
-          {
-            char
-              *args,
-              token[MaxTextExtent];
-
-            const char
-              *p;
-
-            double
-              *arguments;
-
-            register ssize_t
-              x;
-
-            size_t
-              number_arguments;
-
-            /*
-              Polynomial image.
-            */
-            (void) SyncImageSettings(mogrify_info,*image,exception);
-            args=InterpretImageProperties(mogrify_info,*image,argv[i+1],
-              exception);
-            if (args == (char *) NULL)
-              break;
-            p=(char *) args;
-            for (x=0; *p != '\0'; x++)
-            {
-              GetMagickToken(p,&p,token);
-              if (*token == ',')
-                GetMagickToken(p,&p,token);
-            }
-            number_arguments=(size_t) x;
-            arguments=(double *) AcquireQuantumMemory(number_arguments,
-              sizeof(*arguments));
-            if (arguments == (double *) NULL)
-              ThrowWandFatalException(ResourceLimitFatalError,
-                "MemoryAllocationFailed",(*image)->filename);
-            (void) ResetMagickMemory(arguments,0,number_arguments*
-              sizeof(*arguments));
-            p=(char *) args;
-            for (x=0; (x < (ssize_t) number_arguments) && (*p != '\0'); x++)
-            {
-              GetMagickToken(p,&p,token);
-              if (*token == ',')
-                GetMagickToken(p,&p,token);
-              arguments[x]=StringToDouble(token,(char **) NULL);
-            }
-            args=DestroyString(args);
-            mogrify_image=PolynomialImage(*image,number_arguments >> 1,
-              arguments,exception);
-            arguments=(double *) RelinquishMagickMemory(arguments);
-          }
         if (LocaleCompare("posterize",option+1) == 0)
           {
             /*
@@ -8090,6 +8036,70 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
       }
       case 'p':
       {
+        if (LocaleCompare("poly",option+1) == 0)
+          {
+            char
+              *args,
+              token[MaxTextExtent];
+
+            const char
+              *p;
+
+            double
+              *arguments;
+
+            Image
+              *polynomial_image;
+
+            register ssize_t
+              x;
+
+            size_t
+              number_arguments;
+
+            /*
+              Polynomial image.
+            */
+            (void) SyncImageSettings(mogrify_info,*images,exception);
+            args=InterpretImageProperties(mogrify_info,*images,argv[i+1],
+              exception);
+            if (args == (char *) NULL)
+              break;
+            p=(char *) args;
+            for (x=0; *p != '\0'; x++)
+            {
+              GetMagickToken(p,&p,token);
+              if (*token == ',')
+                GetMagickToken(p,&p,token);
+            }
+            number_arguments=(size_t) x;
+            arguments=(double *) AcquireQuantumMemory(number_arguments,
+              sizeof(*arguments));
+            if (arguments == (double *) NULL)
+              ThrowWandFatalException(ResourceLimitFatalError,
+                "MemoryAllocationFailed",(*images)->filename);
+            (void) ResetMagickMemory(arguments,0,number_arguments*
+              sizeof(*arguments));
+            p=(char *) args;
+            for (x=0; (x < (ssize_t) number_arguments) && (*p != '\0'); x++)
+            {
+              GetMagickToken(p,&p,token);
+              if (*token == ',')
+                GetMagickToken(p,&p,token);
+              arguments[x]=StringToDouble(token,(char **) NULL);
+            }
+            args=DestroyString(args);
+            polynomial_image=PolynomialImage(*images,number_arguments >> 1,
+              arguments,exception);
+            arguments=(double *) RelinquishMagickMemory(arguments);
+            if (polynomial_image == (Image *) NULL)
+              {
+                status=MagickFalse;
+                break;
+              }
+            *images=DestroyImageList(*images);
+            *images=polynomial_image;
+          }
         if (LocaleCompare("print",option+1) == 0)
           {
             char
index 3540d7b5494a4a6ca337bd634338196903631aee..ac9ae5daee7c625a8cb1805bc30bbe661b49feab 100644 (file)
@@ -2875,22 +2875,6 @@ static void CLISimpleOperatorImage(MagickCLI *cli_wand,
             _image->interpolate,_exception);
           break;
         }
-      if (LocaleCompare("poly",option+1) == 0)
-        {
-          double
-            *args;
-
-          ssize_t
-            count;
-
-          /* convert argument string into an array of doubles */
-          args = StringToArrayOfDoubles(arg2,&count,_exception);
-          if (args == (double *)NULL )
-            CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2);
-          new_image=PolynomialImage(_image,count >> 1,args,_exception);
-          args=(double *) RelinquishMagickMemory(args);
-          break;
-        }
       if (LocaleCompare("posterize",option+1) == 0)
         {
           flags=ParseGeometry(arg1,&geometry_info);
@@ -4102,6 +4086,22 @@ WandExport void CLIListOperatorImages(MagickCLI *cli_wand,
     }
     case 'p':
     {
+      if (LocaleCompare("poly",option+1) == 0)
+        {
+          double
+            *args;
+
+          ssize_t
+            count;
+
+          /* convert argument string into an array of doubles */
+          args = StringToArrayOfDoubles(arg2,&count,_exception);
+          if (args == (double *)NULL )
+            CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2);
+          new_images=PolynomialImage(_images,count >> 1,args,_exception);
+          args=(double *) RelinquishMagickMemory(args);
+          break;
+        }
       if (LocaleCompare("print",option+1) == 0)
         {
           (void) FormatLocaleFile(stdout,"%s",arg1);