[gimp] app: factor out a few lines of code in gimp_transform_tool_draw()



commit aa1e6c07f5bce00285e9e575dcee943c432cb548
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 19 20:07:10 2017 +0200

    app: factor out a few lines of code in gimp_transform_tool_draw()

 app/tools/gimptransformtool.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 3170802..02ea752 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -787,18 +787,18 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
   GimpTransformTool    *tr_tool = GIMP_TRANSFORM_TOOL (draw_tool);
   GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
   GimpImage            *image   = gimp_display_get_image (tool->display);
+  GimpMatrix3           matrix  = tr_tool->transform;
+
+  if (options->direction == GIMP_TRANSFORM_BACKWARD)
+    gimp_matrix3_invert (&matrix);
 
   if (tr_tool->widget)
     {
       GimpCanvasItem *item;
-      GimpMatrix3     matrix = tr_tool->transform;
       gboolean        show_preview;
 
       show_preview = gimp_transform_options_show_preview (options);
 
-      if (options->direction == GIMP_TRANSFORM_BACKWARD)
-        gimp_matrix3_invert (&matrix);
-
       tr_tool->preview =
         gimp_draw_tool_add_transform_preview (draw_tool,
                                               tool->drawable,
@@ -818,12 +818,12 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
 
       gimp_draw_tool_add_item (draw_tool, item);
 
+      /* FIXME */
       return;
     }
 
   if (options->type == GIMP_TRANSFORM_TYPE_SELECTION)
     {
-      GimpMatrix3         matrix = tr_tool->transform;
       const GimpBoundSeg *orig_in;
       const GimpBoundSeg *orig_out;
       GimpBoundSeg       *segs_in;
@@ -832,9 +832,6 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
       gint                num_segs_out;
       gint                i;
 
-      if (options->direction == GIMP_TRANSFORM_BACKWARD)
-        gimp_matrix3_invert (&matrix);
-
       gimp_channel_boundary (gimp_image_get_mask (image),
                              &orig_in, &orig_out,
                              &num_segs_in, &num_segs_out,
@@ -899,15 +896,11 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
     {
       GimpVectors *vectors;
       GimpStroke  *stroke = NULL;
-      GimpMatrix3  matrix = tr_tool->transform;
 
       vectors = gimp_image_get_active_vectors (image);
 
       if (vectors)
         {
-          if (options->direction == GIMP_TRANSFORM_BACKWARD)
-            gimp_matrix3_invert (&matrix);
-
           while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
             {
               GArray   *coords;


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