[gegl] ripple: fix handling of phase offset for triangle/sawtooth case



commit fb00e687c3031933298260182b74016065bddb57
Author: Simon Budig <simon budig de>
Date:   Tue Apr 24 11:46:49 2018 +0200

    ripple: fix handling of phase offset for triangle/sawtooth case

 operations/common-gpl3+/ripple.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/operations/common-gpl3+/ripple.c b/operations/common-gpl3+/ripple.c
index b0ffafc..09399d2 100644
--- a/operations/common-gpl3+/ripple.c
+++ b/operations/common-gpl3+/ripple.c
@@ -181,14 +181,14 @@ process (GeglOperation       *operation,
             switch (o->wave_type)
               {
                 case GEGL_RIPPLE_WAVE_TYPE_SAWTOOTH:
-                  lambda = div (nx + period / 2, period).rem - phi * period;
+                  lambda = div (nx + period / 2 - phi * period, period).rem;
                   if (lambda < 0)
                     lambda += period;
                   shift = amplitude * (((lambda / period) * 2) - 1);
                   break;
 
                 case GEGL_RIPPLE_WAVE_TYPE_TRIANGLE:
-                  lambda = div (nx + period * 3 / 4, period).rem - phi * period;
+                  lambda = div (nx + period * 3 / 4 - phi * period, period).rem;
                   if (lambda < 0)
                     lambda += period;
                   shift = amplitude * (fabs (((lambda / period) * 4) - 2) - 1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]