[gimp] Bug 767650 - Uncommitted scissors selection is discarded on tool change



commit b4120e3f61360417c8c71dd5eba6e4fbc9241169
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 30 23:08:13 2016 +0100

    Bug 767650 - Uncommitted scissors selection is discarded on tool change
    
    gimp_iscissors_tool_commit(): if the curve is not closed, close and
    recalculate it.

 app/tools/gimpiscissorstool.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index a521e76..4ef6230 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -525,7 +525,6 @@ gimp_iscissors_tool_button_press (GimpTool            *tool,
   gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
 }
 
-
 static void
 iscissors_convert (GimpIscissorsTool *iscissors,
                    GimpDisplay       *display)
@@ -1255,6 +1254,27 @@ gimp_iscissors_tool_commit (GimpIscissorsTool *iscissors,
   GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
   GimpImage            *image   = gimp_display_get_image (display);
 
+  if (! iscissors->curve->closed)
+    {
+      ISegment *first = g_queue_peek_head (iscissors->curve->segments);
+      ISegment *last  = g_queue_peek_tail (iscissors->curve->segments);
+
+      if (first && last)
+        {
+          ISegment *segment;
+
+          segment = icurve_append_segment (iscissors->curve,
+                                           last->x2,
+                                           last->y2,
+                                           first->x1,
+                                           first->y1);
+          icurve_close (iscissors->curve);
+          calculate_segment (iscissors, segment);
+
+          iscissors_convert (iscissors, display);
+        }
+    }
+
   if (iscissors->curve->closed && iscissors->mask)
     {
       gimp_channel_select_channel (gimp_image_get_mask (image),


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