[gimp] Issue #8640: Rotate two selected paths creates error window.



commit b74e6c21987f92b0b283863a5b928fbc4aa6c22a
Author: Jehan <jehan girinstud io>
Date:   Wed Oct 12 17:13:18 2022 +0200

    Issue #8640: Rotate two selected paths creates error window.

 app/tools/gimptransformtool.c | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index e2850f046f..dff0940bb9 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -541,17 +541,42 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
             gimp_item_bounds (GIMP_ITEM (selection),
                               &tr_tool->x1, &tr_tool->y1,
                               &tr_tool->x2, &tr_tool->y2);
+
+            tr_tool->x2 += tr_tool->x1;
+            tr_tool->y2 += tr_tool->y1;
           }
         else
           {
+            GList *iter;
+
             /* without selection, test the emptiness of the path bounds :
              * if empty, use the canvas bounds
              * else use the path bounds
              */
 
-            if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_active_vectors (image)),
-                                    &tr_tool->x1, &tr_tool->y1,
-                                    &tr_tool->x2, &tr_tool->y2))
+            tr_tool->x1 = G_MAXINT;
+            tr_tool->y1 = G_MAXINT;
+            tr_tool->x2 = G_MININT;
+            tr_tool->y2 = G_MININT;
+
+            for (iter = gimp_image_get_selected_vectors (image); iter; iter = iter->next)
+              {
+                GimpItem *item   = iter->data;
+                gint      x;
+                gint      y;
+                gint      width;
+                gint      height;
+
+                if (gimp_item_bounds (item, &x, &y, &width, &height))
+                  {
+                    tr_tool->x1 = MIN (tr_tool->x1, x);
+                    tr_tool->y1 = MIN (tr_tool->y1, y);
+                    tr_tool->x2 = MAX (tr_tool->x2, x + width);
+                    tr_tool->y2 = MAX (tr_tool->y2, y + height);
+                  }
+              }
+
+            if (tr_tool->x2 <= tr_tool->x1 || tr_tool->y2 <= tr_tool->y1)
               {
                 tr_tool->x1 = 0;
                 tr_tool->y1 = 0;
@@ -559,9 +584,6 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
                 tr_tool->y2 = gimp_image_get_height (image);
               }
           }
-
-        tr_tool->x2 += tr_tool->x1;
-        tr_tool->y2 += tr_tool->y1;
       }
 
       break;


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