[gimp/wip/gradient-edit: 204/225] app: improve curved gradient segment	sampling
- From: N/A <ell src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gimp/wip/gradient-edit: 204/225] app: improve curved gradient segment	sampling
 
- Date: Fri,  6 Oct 2017 17:07:36 +0000 (UTC)
 
commit 6ca424adc07a633704d22db6026f9e0de80e5523
Author: Ell <ell_se yahoo com>
Date:   Sat Aug 12 11:56:21 2017 -0400
    app: improve curved gradient segment sampling
    
    Improve the sampling performance of curved gradient segments, and
    its behavior when the segment's midpoint is close to one of its
    limits.
 app/core/gimpgradient.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c
index b228c52..7987b7a 100644
--- a/app/core/gimpgradient.c
+++ b/app/core/gimpgradient.c
@@ -2179,9 +2179,11 @@ gimp_gradient_calc_curved_factor (gdouble middle,
                                   gdouble pos)
 {
   if (middle < EPSILON)
-    middle = EPSILON;
+    return 1.0;
+  else if (1.0 - middle < EPSILON)
+    return 0.0;
 
-  return pow (pos, log (0.5) / log (middle));
+  return exp (-G_LN2 * log (pos) / log (middle));
 }
 
 static inline gdouble
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]