]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 2 Nov 2011 19:30:35 +0000 (19:30 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 2 Nov 2011 19:30:35 +0000 (19:30 +0000)
MagickCore/fx.c

index 1d76ff8b3d676e4a5974afbc9555d2f080773c09..9957e7cee3faa05bd579bf913baf7b834046124e 100644 (file)
@@ -1303,6 +1303,13 @@ static MagickRealType
   FxEvaluateSubexpression(FxInfo *,const PixelChannel,const ssize_t,
     const ssize_t,const char *,MagickRealType *,ExceptionInfo *);
 
+static MagickOffsetType FxGCD(MagickOffsetType alpha,MagickOffsetType beta)
+{
+  if (beta != 0)
+    return(FxGCD(beta,alpha % beta));
+  return(alpha);
+}
+
 static inline MagickRealType FxMax(FxInfo *fx_info,const PixelChannel channel,
   const ssize_t x,const ssize_t y,const char *expression,
   ExceptionInfo *exception)
@@ -2592,6 +2599,16 @@ static MagickRealType FxEvaluateSubexpression(FxInfo *fx_info,
           gamma=exp((double) (-alpha*alpha/2.0))/sqrt(2.0*MagickPI);
           return((MagickRealType) gamma);
         }
+      if (LocaleNCompare(expression,"gcd",3) == 0)
+        {
+          MagickOffsetType
+            gcd;
+
+          alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,beta,
+            exception);
+          gcd=FxGCD((MagickOffsetType) alpha,(MagickOffsetType) *beta);
+          return((MagickRealType) gcd);
+        }
       if (LocaleCompare(expression,"g") == 0)
         return(FxGetSymbol(fx_info,channel,x,y,expression,exception));
       break;