]> granicus.if.org Git - imagemagick/commitdiff
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=28179
authorCristy <urban-warrior@imagemagick.org>
Mon, 10 Aug 2015 23:15:07 +0000 (19:15 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 10 Aug 2015 23:15:07 +0000 (19:15 -0400)
MagickCore/fx.c

index 37fd73ae2338ec30e701302dd823f65b672c5f1e..d20680df07f0eae1022802b5902c84f189c0da73 100644 (file)
@@ -2232,14 +2232,26 @@ static double FxEvaluateSubexpression(FxInfo *fx_info,
         }
         case LogicalAndOperator:
         {
-          gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,beta,exception);
-          *beta=(alpha > 0.0) && (gamma > 0.0) ? 1.0 : 0.0;
+          p++;
+          if (alpha <= 0.0)
+            {
+              *beta=0.0;
+              return(*beta);
+            }
+          gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,beta,exception);
+          *beta=(gamma > 0.0) ? 1.0 : 0.0;
           return(*beta);
         }
         case LogicalOrOperator:
         {
-          gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,beta,exception);
-          *beta=(alpha > 0.0) || (gamma > 0.0) ? 1.0 : 0.0;
+          p++;
+          if (alpha > 0.0)
+            {
+             *beta=1.0;
+             return(*beta);
+            }
+          gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,beta,exception);
+          *beta=(gamma > 0.0) ? 1.0 : 0.0;
           return(*beta);
         }
         case '?':