[gegl] radial-gradient: handle mipmap levels correctly



commit 4fbe57bbbcbc36eb4372730db5316d485fc6c5b6
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Feb 2 22:01:02 2019 +0100

    radial-gradient: handle mipmap levels correctly

 operations/common/radial-gradient.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/operations/common/radial-gradient.c b/operations/common/radial-gradient.c
index e61be9795..3f19948d9 100644
--- a/operations/common/radial-gradient.c
+++ b/operations/common/radial-gradient.c
@@ -73,7 +73,8 @@ process (GeglOperation       *operation,
   gfloat         *out_pixel = out_buf;
   gfloat         color1[4];
   gfloat         color2[4];
-  gfloat         length = dist (o->start_x, o->start_y, o->end_x, o->end_y);
+  gfloat         factor = 1.0 / (1<<level);
+  gfloat         length = dist (o->start_x, o->start_y, o->end_x, o->end_y) * factor;
 
   gegl_color_get_pixel (o->start_color, babl_format ("R'G'B'A float"), color1);
   gegl_color_get_pixel (o->end_color, babl_format ("R'G'B'A float"), color2);
@@ -90,7 +91,7 @@ process (GeglOperation       *operation,
           for (x = roi->x; x < roi->x + roi->width; ++x)
             {
               gint c;
-              gfloat v = dist (x, y, o->start_x, o->start_y) / length;
+              gfloat v = dist (x/factor, y/factor, o->start_x*factor, o->start_y*factor) / length;
 
               if (v > 1.0f - GEGL_FLOAT_EPSILON)
                 v = 1.0f;


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