[gimp] app: remove odd ratio scaling, replace with range check for nan



commit 60847cce734d175b70e4ac3041d459e0051709a7
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jan 15 01:28:29 2017 +0100

    app: remove odd ratio scaling, replace with range check for nan

 app/operations/layer-modes/gimpoperationdivide.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationdivide.c 
b/app/operations/layer-modes/gimpoperationdivide.c
index 7ff6fca..d56534d 100644
--- a/app/operations/layer-modes/gimpoperationdivide.c
+++ b/app/operations/layer-modes/gimpoperationdivide.c
@@ -106,10 +106,14 @@ gimp_operation_divide_process_pixels (gfloat              *in,
 
           for (b = RED; b < ALPHA; b++)
             {
-              gfloat comp = (4294967296.0 / 4294967295.0 * in[b]) / (1.0 / 4294967295.0 + layer[b]);
+              gfloat comp = in[b] / layer[b];
+
+              /* make infitinities(or NaN) correspond to a really high number,
+               * to get more predictable math */
+              if (!(comp > -4294967296.0f && comp < 4294967296.0f))
+                comp = 4294967296.0f;
 
               out[b] = comp * comp_alpha + in[b] * (1.0 - comp_alpha);
-              out[b] = CLAMP (out[b], 0.0, 1.0);
             }
         }
       else


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