[gimp] app: round curve point position when displaying it as int.



commit a761ed3ae8aada9a9ccab113ae9293243127d42e
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.
    
    (cherry picked from commit 7b1af1f0cb686ea6b7d2d917ec6c4b91ea0ec934)

 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 cf09aa2bc7..057e80ad72 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -735,12 +735,12 @@ gimp_curve_view_draw (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]