[gimp/gimp-2-10] app: proper signedness for return value of gimp_edgel_region_area().



commit b2181d0fb253b9ba6f4ff64a6ded3e3b69eccb83
Author: Jehan <jehan girinstud io>
Date:   Sat Feb 9 23:13:58 2019 +0100

    app: proper signedness for return value of gimp_edgel_region_area().
    
    It is just weird to return a negative area and multiply it by -1.
    Just apply the proper signs from the start.
    
    (cherry picked from commit 14e74244035eff84b2fc0661e9c7637d14006019)

 app/core/gimplineart.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimplineart.c b/app/core/gimplineart.c
index d1d2d83cc5..f0b9a0ec8e 100644
--- a/app/core/gimplineart.c
+++ b/app/core/gimplineart.c
@@ -256,7 +256,7 @@ static glong      gimp_edgel_track_mark           (GeglBuffer         *mask,
                                                    Edgel               edgel,
                                                    long                size_limit);
 static glong      gimp_edgel_region_area          (const GeglBuffer   *mask,
-                                                   Edgel               starting_edgel);
+                                                   Edgel               start_edgel);
 
 /* Edgel set */
 
@@ -1843,7 +1843,7 @@ gimp_lineart_curve_creates_region (GeglBuffer *mask,
               count = gimp_edgel_track_mark (mask, e, max_edgel_count);
               if ((count != -1) && (count <= max_edgel_count))
                 {
-                  area = -1 * gimp_edgel_region_area (mask, e);
+                  area = gimp_edgel_region_area (mask, e);
 
                   if (area >= lower_size_limit && area <= upper_size_limit)
                     {
@@ -2287,14 +2287,14 @@ gimp_edgel_region_area (const GeglBuffer *mask,
                         Edgel             start_edgel)
 {
   Edgel edgel = start_edgel;
-  long  area = 0;
+  glong area = 0;
 
   do
     {
       if (edgel.direction == XPlusDirection)
-        area += edgel.x;
+        area -= edgel.x;
       else if (edgel.direction == XMinusDirection)
-        area -= edgel.x - 1;
+        area += edgel.x - 1;
 
       gimp_edgelset_next8 (mask, &edgel, &edgel);
     }


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