[gimp] app: in tools, show source location indicator at pixel center



commit d8e8a276aa9bbd356a4f451e5718ead4be9f5654
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 3 13:00:06 2017 -0400

    app: in tools, show source location indicator at pixel center
    
    ... instead of at the top-left corner of the pixel

 app/tools/gimpsourcetool.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c
index eccd959..ca60f94 100644
--- a/app/tools/gimpsourcetool.c
+++ b/app/tools/gimpsourcetool.c
@@ -388,11 +388,16 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
       GimpDisplayShell *src_shell;
       gint              off_x;
       gint              off_y;
+      gdouble           src_x;
+      gdouble           src_y;
 
       src_shell = gimp_display_get_shell (source_tool->src_display);
 
       gimp_item_get_offset (GIMP_ITEM (source->src_drawable), &off_x, &off_y);
 
+      src_x = source_tool->src_x + off_x + 0.5;
+      src_y = source_tool->src_y + off_y + 0.5;
+
       if (source_tool->src_outline)
         {
           gimp_display_shell_remove_tool_item (src_shell,
@@ -405,8 +410,7 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
           source_tool->src_outline =
             gimp_brush_tool_create_outline (GIMP_BRUSH_TOOL (source_tool),
                                             source_tool->src_display,
-                                            source_tool->src_x + off_x,
-                                            source_tool->src_y + off_y);
+                                            src_x, src_y);
 
           if (source_tool->src_outline)
             {
@@ -433,8 +437,7 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
                 gimp_canvas_handle_new (src_shell,
                                         GIMP_HANDLE_CROSS,
                                         GIMP_HANDLE_ANCHOR_CENTER,
-                                        source_tool->src_x + off_x,
-                                        source_tool->src_y + off_y,
+                                        src_x, src_y,
                                         GIMP_TOOL_HANDLE_SIZE_CROSS,
                                         GIMP_TOOL_HANDLE_SIZE_CROSS);
               gimp_display_shell_add_tool_item (src_shell,
@@ -444,8 +447,7 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
           else
             {
               gimp_canvas_handle_set_position (source_tool->src_handle,
-                                               source_tool->src_x + off_x,
-                                               source_tool->src_y + off_y);
+                                               src_x, src_y);
             }
         }
     }


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