[gimp/gimp-2-10] app: round curve point position when displaying it as int.



commit 7b1af1f0cb686ea6b7d2d917ec6c4b91ea0ec934
Author: Jehan <jehan girinstud io>
Date:   Wed May 8 13:58:45 2019 +0900

    app: round curve point position when displaying it as int.
    
    Int casting results to truncation. First this is a bit counter-intuitive
    as we usually expect rounding to the nearest integer. Moreover with the
    new GUI updates on curve and curve tool, we end up with a mismatch as
    the new Input/Output spin buttons where indeed showing rounded integers
    whereas the coordinate indicator was showing truncated integers.
    
    Make all these show same rounded value.

 app/widgets/gimpcurveview.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 121f5eb010..c34d06e187 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -732,12 +732,12 @@ gimp_curve_view_expose (GtkWidget      *widget,
           /*  stupid heuristic: special-case for 0..255  */
 
           g_snprintf (buf, sizeof (buf), "x:%3d y:%3d",
-                      (gint) (view->cursor_x *
-                              (view->range_x_max - view->range_x_min) +
-                              view->range_x_min),
-                      (gint) ((1.0 - view->cursor_y) *
-                              (view->range_y_max - view->range_y_min) +
-                              view->range_y_min));
+                      (gint) round (view->cursor_x *
+                                    (view->range_x_max - view->range_x_min) +
+                                    view->range_x_min),
+                      (gint) round ((1.0 - view->cursor_y) *
+                                    (view->range_y_max - view->range_y_min) +
+                                    view->range_y_min));
         }
       else if (view->range_x_max == 100.0 &&
                view->range_y_max == 100.0)


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