[gimp] app: use half the cache size for symmetric conical gradients



commit 6e87ceb89618d4645ff3158007215ad95f33dbac
Author: Ell <ell_se yahoo com>
Date:   Wed Apr 25 17:39:10 2018 -0400

    app: use half the cache size for symmetric conical gradients
    
    Symmetric conical gradients only span half a revolution (unlike
    assymetric ones, which span an entire revolution), and therefore
    require only half the cache size.

 app/core/gimpdrawable-gradient.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpdrawable-gradient.c b/app/core/gimpdrawable-gradient.c
index 4d1b37c..fcd088f 100644
--- a/app/core/gimpdrawable-gradient.c
+++ b/app/core/gimpdrawable-gradient.c
@@ -277,6 +277,12 @@ gimp_drawable_gradient_adjust_coords (GimpDrawable        *drawable,
         r = MAX (r, hypot (region->x + region->width - *startx,
                            region->y + region->height - *starty));
 
+        /* symmetric conical gradients only span half a revolution, and
+         * therefore require only half the cache size.
+         */
+        if (gradient_type == GIMP_GRADIENT_CONICAL_SYMMETRIC)
+          r /= 2.0;
+
         gimp_vector2_set (&v, *endx - *startx, *endy - *starty);
         gimp_vector2_normalize (&v);
         gimp_vector2_mul (&v, 2.0 * G_PI * r);


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