]> granicus.if.org Git - imagemagick/commitdiff
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=28186
authorCristy <urban-warrior@imagemagick.org>
Wed, 12 Aug 2015 11:42:13 +0000 (07:42 -0400)
committerCristy <urban-warrior@imagemagick.org>
Wed, 12 Aug 2015 11:42:13 +0000 (07:42 -0400)
MagickCore/composite.c

index a68cd8e2278bc6196a14235bc4b4ace7a957b811..3fe3295c6a4980a72c5208903c47223d6b14da14 100644 (file)
@@ -2127,15 +2127,19 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
           case ModulusAddCompositeOp:
           {
             pixel=Sc+Dc;
-            if (pixel > QuantumRange)
+            while (pixel > QuantumRange)
               pixel-=QuantumRange;
+            while (pixel < 0.0)
+              pixel+=QuantumRange;
             pixel=(Sa*Da*pixel+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
             break;
           }
           case ModulusSubtractCompositeOp:
           {
             pixel=Sc-Dc;
-            if (pixel < 0.0)
+            while (pixel > QuantumRange)
+              pixel-=QuantumRange;
+            while (pixel < 0.0)
               pixel+=QuantumRange;
             pixel=(Sa*Da*pixel+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
             break;