[gimp] pdb: return the resulting floating selection in the item transform API



commit 4d3b52ec6ced2b0ecfb28c8c90e1f4b415babf1e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 16 00:36:03 2010 +0200

    pdb: return the resulting floating selection in the item transform API
    
    This was actually documented to be the return value of all transform
    procedures since 1.2, but it was always broken and returned the
    passed-in drawable. Therefore it's only fixed for the new item API,
    the old procedures keep their semantics (and will all be deprecated
    anyway).

 app/core/gimpdrawable-transform.c       |   87 +++++++-------
 app/core/gimpdrawable-transform.h       |   94 ++++++++--------
 app/pdb/drawable-transform-cmds.c       |  190 ++++++++++++++++++-------------
 app/pdb/item-transform-cmds.c           |  177 +++++++++++++++++++---------
 app/pdb/transform-tools-cmds.c          |   75 +++++++-----
 tools/pdbgen/pdb/drawable_transform.pdb |   46 +++++---
 tools/pdbgen/pdb/item_transform.pdb     |   51 ++++++---
 tools/pdbgen/pdb/transform_tools.pdb    |   75 +++++++-----
 8 files changed, 476 insertions(+), 319 deletions(-)
---
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 2ae8a77..d0a9914 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -538,7 +538,7 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable     *drawable,
   return new_tiles;
 }
 
-gboolean
+GimpDrawable *
 gimp_drawable_transform_affine (GimpDrawable           *drawable,
                                 GimpContext            *context,
                                 const GimpMatrix3      *matrix,
@@ -548,22 +548,23 @@ gimp_drawable_transform_affine (GimpDrawable           *drawable,
                                 GimpTransformResize     clip_result,
                                 GimpProgress           *progress)
 {
-  GimpImage   *image;
-  TileManager *orig_tiles;
-  gboolean     new_layer;
-  gboolean     success = FALSE;
+  GimpImage    *image;
+  TileManager  *orig_tiles;
+  gboolean      new_layer;
+  GimpDrawable *result = NULL;
 
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
-  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
-  g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
-  g_return_val_if_fail (matrix != NULL, FALSE);
-  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
+  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+  g_return_val_if_fail (matrix != NULL, NULL);
+  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   /* Start a transform undo group */
   gimp_image_undo_group_start (image,
-                               GIMP_UNDO_GROUP_TRANSFORM, C_("undo-type", "Transform"));
+                               GIMP_UNDO_GROUP_TRANSFORM,
+                               C_("undo-type", "Transform"));
 
   /* Cut/Copy from the specified drawable */
   orig_tiles = gimp_drawable_transform_cut (drawable, context, &new_layer);
@@ -607,8 +608,8 @@ gimp_drawable_transform_affine (GimpDrawable           *drawable,
 
       if (new_tiles)
         {
-          success = gimp_drawable_transform_paste (drawable, new_tiles,
-                                                   new_layer);
+          result = gimp_drawable_transform_paste (drawable, new_tiles,
+                                                  new_layer);
           tile_manager_unref (new_tiles);
         }
     }
@@ -616,24 +617,24 @@ gimp_drawable_transform_affine (GimpDrawable           *drawable,
   /*  push the undo group end  */
   gimp_image_undo_group_end (image);
 
-  return success;
+  return result;
 }
 
-gboolean
+GimpDrawable *
 gimp_drawable_transform_flip (GimpDrawable        *drawable,
                               GimpContext         *context,
                               GimpOrientationType  flip_type,
                               gdouble              axis,
                               gboolean             clip_result)
 {
-  GimpImage   *image;
-  TileManager *orig_tiles;
-  gboolean     new_layer;
-  gboolean     success = FALSE;
+  GimpImage    *image;
+  TileManager  *orig_tiles;
+  gboolean      new_layer;
+  GimpDrawable *result = NULL;
 
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
-  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
-  g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
+  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -680,8 +681,8 @@ gimp_drawable_transform_flip (GimpDrawable        *drawable,
 
       if (new_tiles)
         {
-          success = gimp_drawable_transform_paste (drawable, new_tiles,
-                                                   new_layer);
+          result = gimp_drawable_transform_paste (drawable, new_tiles,
+                                                  new_layer);
           tile_manager_unref (new_tiles);
         }
     }
@@ -689,10 +690,10 @@ gimp_drawable_transform_flip (GimpDrawable        *drawable,
   /*  push the undo group end  */
   gimp_image_undo_group_end (image);
 
-  return success;
+  return result;
 }
 
-gboolean
+GimpDrawable *
 gimp_drawable_transform_rotate (GimpDrawable     *drawable,
                                 GimpContext      *context,
                                 GimpRotationType  rotate_type,
@@ -700,14 +701,14 @@ gimp_drawable_transform_rotate (GimpDrawable     *drawable,
                                 gdouble           center_y,
                                 gboolean          clip_result)
 {
-  GimpImage   *image;
-  TileManager *orig_tiles;
-  gboolean     new_layer;
-  gboolean     success = FALSE;
+  GimpImage    *image;
+  TileManager  *orig_tiles;
+  gboolean      new_layer;
+  GimpDrawable *result = NULL;
 
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
-  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
-  g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
+  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -753,8 +754,8 @@ gimp_drawable_transform_rotate (GimpDrawable     *drawable,
 
       if (new_tiles)
         {
-          success = gimp_drawable_transform_paste (drawable, new_tiles,
-                                                   new_layer);
+          result = gimp_drawable_transform_paste (drawable, new_tiles,
+                                                  new_layer);
           tile_manager_unref (new_tiles);
         }
     }
@@ -762,7 +763,7 @@ gimp_drawable_transform_rotate (GimpDrawable     *drawable,
   /*  push the undo group end  */
   gimp_image_undo_group_end (image);
 
-  return success;
+  return result;
 }
 
 TileManager *
@@ -821,7 +822,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
   return tiles;
 }
 
-gboolean
+GimpDrawable *
 gimp_drawable_transform_paste (GimpDrawable *drawable,
                                TileManager  *tiles,
                                gboolean      new_layer)
@@ -832,9 +833,9 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
   gint         offset_x;
   gint         offset_y;
 
-  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
-  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
-  g_return_val_if_fail (tiles != NULL, FALSE);
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+  g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
+  g_return_val_if_fail (tiles != NULL, NULL);
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -843,7 +844,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
   else if (GIMP_IS_CHANNEL (drawable))
     undo_desc = C_("undo-type", "Transform Channel");
   else
-    return FALSE;
+    return NULL;
 
   tile_manager_get_offsets (tiles, &offset_x, &offset_y);
 
@@ -860,6 +861,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
       gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
 
       floating_sel_attach (layer, drawable);
+
+      drawable = GIMP_DRAWABLE (layer);
     }
   else
     {
@@ -882,5 +885,5 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
 
   gimp_image_undo_group_end (image);
 
-  return TRUE;
+  return drawable;
 }
diff --git a/app/core/gimpdrawable-transform.h b/app/core/gimpdrawable-transform.h
index 2b99c7f..c530a2a 100644
--- a/app/core/gimpdrawable-transform.h
+++ b/app/core/gimpdrawable-transform.h
@@ -32,58 +32,58 @@ typedef enum
 } GimpTransformBoundingBox;
 
 
-TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    TileManager            *orig_tiles,
-                                                    const GimpMatrix3      *matrix,
-                                                    GimpTransformDirection  direction,
-                                                    GimpInterpolationType   interpolation_type,
-                                                    gint                    recursion_level,
-                                                    GimpTransformResize     clip_result,
-                                                    GimpProgress           *progress);
-TileManager * gimp_drawable_transform_tiles_flip   (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    TileManager            *orig_tiles,
-                                                    GimpOrientationType     flip_type,
-                                                    gdouble                 axis,
-                                                    gboolean                clip_result);
+TileManager  * gimp_drawable_transform_tiles_affine (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     TileManager            *orig_tiles,
+                                                     const GimpMatrix3      *matrix,
+                                                     GimpTransformDirection  direction,
+                                                     GimpInterpolationType   interpolation_type,
+                                                     gint                    recursion_level,
+                                                     GimpTransformResize     clip_result,
+                                                     GimpProgress           *progress);
+TileManager  * gimp_drawable_transform_tiles_flip   (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     TileManager            *orig_tiles,
+                                                     GimpOrientationType     flip_type,
+                                                     gdouble                 axis,
+                                                     gboolean                clip_result);
 
-TileManager * gimp_drawable_transform_tiles_rotate (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    TileManager            *orig_tiles,
-                                                    GimpRotationType        rotate_type,
-                                                    gdouble                 center_x,
-                                                    gdouble                 center_y,
-                                                    gboolean                clip_result);
+TileManager  * gimp_drawable_transform_tiles_rotate (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     TileManager            *orig_tiles,
+                                                     GimpRotationType        rotate_type,
+                                                     gdouble                 center_x,
+                                                     gdouble                 center_y,
+                                                     gboolean                clip_result);
 
-gboolean      gimp_drawable_transform_affine       (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    const GimpMatrix3      *matrix,
-                                                    GimpTransformDirection  direction,
-                                                    GimpInterpolationType   interpolation_type,
-                                                    gint                    recursion_level,
-                                                    GimpTransformResize     clip_result,
-                                                    GimpProgress           *progress);
+GimpDrawable * gimp_drawable_transform_affine       (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     const GimpMatrix3      *matrix,
+                                                     GimpTransformDirection  direction,
+                                                     GimpInterpolationType   interpolation_type,
+                                                     gint                    recursion_level,
+                                                     GimpTransformResize     clip_result,
+                                                     GimpProgress           *progress);
 
-gboolean      gimp_drawable_transform_flip         (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    GimpOrientationType     flip_type,
-                                                    gdouble                 axis,
-                                                    gboolean                clip_result);
+GimpDrawable * gimp_drawable_transform_flip         (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     GimpOrientationType     flip_type,
+                                                     gdouble                 axis,
+                                                     gboolean                clip_result);
 
-gboolean      gimp_drawable_transform_rotate       (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    GimpRotationType        rotate_type,
-                                                    gdouble                 center_x,
-                                                    gdouble                 center_y,
-                                                    gboolean                clip_result);
+GimpDrawable * gimp_drawable_transform_rotate       (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     GimpRotationType        rotate_type,
+                                                     gdouble                 center_x,
+                                                     gdouble                 center_y,
+                                                     gboolean                clip_result);
 
-TileManager * gimp_drawable_transform_cut          (GimpDrawable           *drawable,
-                                                    GimpContext            *context,
-                                                    gboolean               *new_layer);
-gboolean      gimp_drawable_transform_paste        (GimpDrawable           *drawable,
-                                                    TileManager            *tiles,
-                                                    gboolean                new_layer);
+TileManager  * gimp_drawable_transform_cut          (GimpDrawable           *drawable,
+                                                     GimpContext            *context,
+                                                     gboolean               *new_layer);
+GimpDrawable * gimp_drawable_transform_paste        (GimpDrawable           *drawable,
+                                                     TileManager            *tiles,
+                                                     gboolean                new_layer);
 
 
 #endif  /*  __GIMP_DRAWABLE_TRANSFORM_H__  */
diff --git a/app/pdb/drawable-transform-cmds.c b/app/pdb/drawable-transform-cmds.c
index 20b4daa..be8648a 100644
--- a/app/pdb/drawable-transform-cmds.c
+++ b/app/pdb/drawable-transform-cmds.c
@@ -76,10 +76,13 @@ drawable_transform_flip_simple_invoker (GimpProcedure      *procedure,
           gimp_transform_get_flip_axis (x, y, width, height,
                                         flip_type, auto_center, &axis);
 
-          success = gimp_drawable_transform_flip (drawable, context,
-                                                  flip_type,
-                                                  axis,
-                                                  clip_result);
+          if (! gimp_drawable_transform_flip (drawable, context,
+                                              flip_type,
+                                              axis,
+                                              clip_result))
+            {
+              success = FALSE;
+            }
         }
     }
 
@@ -149,11 +152,13 @@ drawable_transform_flip_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Flipping"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -224,11 +229,13 @@ drawable_transform_flip_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Flipping"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -311,11 +318,13 @@ drawable_transform_perspective_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Perspective"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -396,11 +405,13 @@ drawable_transform_perspective_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Perspective"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -455,10 +466,13 @@ drawable_transform_rotate_simple_invoker (GimpProcedure      *procedure,
           gimp_transform_get_rotate_center (x, y, width, height,
                                             auto_center, &cx, &cy);
 
-          success = gimp_drawable_transform_rotate (drawable, context,
-                                                    rotate_type,
-                                                    cx, cy,
-                                                    clip_result);
+          if (! gimp_drawable_transform_rotate (drawable, context,
+                                                rotate_type,
+                                                cx, cy,
+                                                clip_result))
+            {
+              success = FALSE;
+            }
         }
     }
 
@@ -532,11 +546,13 @@ drawable_transform_rotate_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Rotating"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -611,11 +627,13 @@ drawable_transform_rotate_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Rotating"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -689,11 +707,13 @@ drawable_transform_scale_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -765,11 +785,13 @@ drawable_transform_scale_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -839,11 +861,13 @@ drawable_transform_shear_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Shearing"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -911,11 +935,13 @@ drawable_transform_shear_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Shearing"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -996,11 +1022,13 @@ drawable_transform_2d_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("2D Transform"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -1079,11 +1107,13 @@ drawable_transform_2d_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("2D Transforming"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -1172,11 +1202,13 @@ drawable_transform_matrix_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("2D Transforming"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, transform_direction,
-                                                    interpolation, recursion_level,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, transform_direction,
+                                                interpolation, recursion_level,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -1263,11 +1295,13 @@ drawable_transform_matrix_default_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("2D Transforming"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    clip_result, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                clip_result, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
index f4bb834..65badea 100644
--- a/app/pdb/item-transform-cmds.c
+++ b/app/pdb/item-transform-cmds.c
@@ -82,9 +82,16 @@ item_transform_flip_simple_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_flip (GIMP_DRAWABLE (item), context,
-                                                      flip_type, axis,
-                                                      pdb_context->transform_resize);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_flip (GIMP_DRAWABLE (item), context,
+                                                       flip_type, axis,
+                                                       pdb_context->transform_resize);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -152,13 +159,20 @@ item_transform_flip_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -243,13 +257,20 @@ item_transform_perspective_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -318,11 +339,18 @@ item_transform_rotate_simple_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_rotate (GIMP_DRAWABLE (item),
-                                                        context,
-                                                        rotate_type,
-                                                        center_x, center_y,
-                                                        pdb_context->transform_resize);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_rotate (GIMP_DRAWABLE (item),
+                                                         context,
+                                                         rotate_type,
+                                                         center_x, center_y,
+                                                         pdb_context->transform_resize);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -396,13 +424,20 @@ item_transform_rotate_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -478,13 +513,20 @@ item_transform_scale_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -556,13 +598,20 @@ item_transform_shear_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -645,13 +694,20 @@ item_transform_2d_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
@@ -742,13 +798,20 @@ item_transform_matrix_invoker (GimpProcedure      *procedure,
 
           if (GIMP_IS_DRAWABLE (item))
             {
-              success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                        context, &matrix,
-                                                        pdb_context->transform_direction,
-                                                        pdb_context->interpolation,
-                                                        pdb_context->transform_recursion,
-                                                        pdb_context->transform_resize,
-                                                        progress);
+              GimpDrawable *drawable;
+
+              drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                         context, &matrix,
+                                                         pdb_context->transform_direction,
+                                                         pdb_context->interpolation,
+                                                         pdb_context->transform_recursion,
+                                                         pdb_context->transform_resize,
+                                                         progress);
+
+              if (drawable)
+                item = GIMP_ITEM (drawable);
+              else
+                success = FALSE;
             }
           else
             {
diff --git a/app/pdb/transform-tools-cmds.c b/app/pdb/transform-tools-cmds.c
index 349763c..2ae65c7 100644
--- a/app/pdb/transform-tools-cmds.c
+++ b/app/pdb/transform-tools-cmds.c
@@ -72,8 +72,11 @@ flip_invoker (GimpProcedure      *procedure,
           gimp_transform_get_flip_axis (x, y, width, height,
                                         flip_type, TRUE, &axis);
 
-          success = gimp_drawable_transform_flip (drawable, context,
-                                                  flip_type, axis, FALSE);
+          if (! gimp_drawable_transform_flip (drawable, context,
+                                              flip_type, axis, FALSE))
+            {
+              success = FALSE;
+            }
         }
     }
 
@@ -149,12 +152,14 @@ perspective_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Perspective"), FALSE);
 
-          /* Perspective the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix,
-                                                    GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    FALSE, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix,
+                                                GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                FALSE, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -218,12 +223,14 @@ rotate_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Rotating"), FALSE);
 
-          /* Rotate the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix,
-                                                    GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    FALSE, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix,
+                                                GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                FALSE, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -294,12 +301,14 @@ scale_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
 
-          /* Scale the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix,
-                                                    GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    FALSE, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix,
+                                                GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                FALSE, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -365,12 +374,14 @@ shear_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("Shearing"), FALSE);
 
-          /* Shear the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix,
-                                                    GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    FALSE, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix,
+                                                GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                FALSE, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
@@ -441,11 +452,13 @@ transform_2d_invoker (GimpProcedure      *procedure,
           if (progress)
             gimp_progress_start (progress, _("2D Transform"), FALSE);
 
-          /* Transform the selection */
-          success = gimp_drawable_transform_affine (drawable, context,
-                                                    &matrix, GIMP_TRANSFORM_FORWARD,
-                                                    interpolation_type, 3,
-                                                    FALSE, progress);
+          if (! gimp_drawable_transform_affine (drawable, context,
+                                                &matrix, GIMP_TRANSFORM_FORWARD,
+                                                interpolation_type, 3,
+                                                FALSE, progress))
+            {
+              success = FALSE;
+            }
 
           if (progress)
             gimp_progress_end (progress);
diff --git a/tools/pdbgen/pdb/drawable_transform.pdb b/tools/pdbgen/pdb/drawable_transform.pdb
index 824d3cf..2b62348 100644
--- a/tools/pdbgen/pdb/drawable_transform.pdb
+++ b/tools/pdbgen/pdb/drawable_transform.pdb
@@ -54,11 +54,13 @@ $assemble_matrix
       if (progress)
         gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
 
-      /* Transform the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix, transform_direction,
-                                                interpolation, recursion_level,
-                                                clip_result, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix, transform_direction,
+                                            interpolation, recursion_level,
+                                            clip_result, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -104,11 +106,13 @@ $assemble_matrix
       if (progress)
         gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
 
-      /* Transform the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix, GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                clip_result, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix, GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            clip_result, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -173,10 +177,13 @@ HELP
       gimp_transform_get_flip_axis (x, y, width, height,
                                     flip_type, auto_center, &axis);
 
-      success = gimp_drawable_transform_flip (drawable, context,
-                                              flip_type,
-                                              axis,
-                                              clip_result);
+      if (! gimp_drawable_transform_flip (drawable, context,
+                                          flip_type,
+                                          axis,
+                                          clip_result))
+        {
+          success = FALSE;
+        }
     }
 }
 CODE
@@ -476,10 +483,13 @@ HELP
       gimp_transform_get_rotate_center (x, y, width, height,
                                         auto_center, &cx, &cy);
 
-      success = gimp_drawable_transform_rotate (drawable, context,
-                                                rotate_type,
-                                                cx, cy,
-                                                clip_result);
+      if (! gimp_drawable_transform_rotate (drawable, context,
+                                            rotate_type,
+                                            cx, cy,
+                                            clip_result))
+        {
+          success = FALSE;
+        }
     }
 }
 CODE
diff --git a/tools/pdbgen/pdb/item_transform.pdb b/tools/pdbgen/pdb/item_transform.pdb
index f5dc223..831436d 100644
--- a/tools/pdbgen/pdb/item_transform.pdb
+++ b/tools/pdbgen/pdb/item_transform.pdb
@@ -54,13 +54,20 @@ $assemble_matrix
 
       if (GIMP_IS_DRAWABLE (item))
         {
-          success = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
-                                                    context, &matrix,
-                                                    pdb_context->transform_direction,
-                                                    pdb_context->interpolation,
-                                                    pdb_context->transform_recursion,
-                                                    pdb_context->transform_resize,
-                                                    progress);
+          GimpDrawable *drawable;
+
+          drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+                                                     context, &matrix,
+                                                     pdb_context->transform_direction,
+                                                     pdb_context->interpolation,
+                                                     pdb_context->transform_recursion,
+                                                     pdb_context->transform_resize,
+                                                     progress);
+
+          if (drawable)
+            item = GIMP_ITEM (drawable);
+          else
+            success = FALSE;
         }
       else
         {
@@ -140,9 +147,16 @@ HELP
 
       if (GIMP_IS_DRAWABLE (item))
         {
-          success = gimp_drawable_transform_flip (GIMP_DRAWABLE (item), context,
-                                                  flip_type, axis,
-                                                  pdb_context->transform_resize);
+          GimpDrawable *drawable;
+
+          drawable = gimp_drawable_transform_flip (GIMP_DRAWABLE (item), context,
+                                                   flip_type, axis,
+                                                   pdb_context->transform_resize);
+
+          if (drawable)
+            item = GIMP_ITEM (drawable);
+          else
+            success = FALSE;
         }
       else
         {
@@ -327,11 +341,18 @@ HELP
 
       if (GIMP_IS_DRAWABLE (item))
         {
-          success = gimp_drawable_transform_rotate (GIMP_DRAWABLE (item),
-                                                    context,
-                                                    rotate_type,
-                                                    center_x, center_y,
-                                                    pdb_context->transform_resize);
+          GimpDrawable *drawable;
+
+          drawable = gimp_drawable_transform_rotate (GIMP_DRAWABLE (item),
+                                                     context,
+                                                     rotate_type,
+                                                     center_x, center_y,
+                                                     pdb_context->transform_resize);
+
+          if (drawable)
+            item = GIMP_ITEM (drawable);
+          else
+            success = FALSE;
         }
       else
         {
diff --git a/tools/pdbgen/pdb/transform_tools.pdb b/tools/pdbgen/pdb/transform_tools.pdb
index e49b9ae..43a687b 100644
--- a/tools/pdbgen/pdb/transform_tools.pdb
+++ b/tools/pdbgen/pdb/transform_tools.pdb
@@ -47,8 +47,11 @@ sub flip {
       gimp_transform_get_flip_axis (x, y, width, height,
                                     flip_type, TRUE, &axis);
 
-      success = gimp_drawable_transform_flip (drawable, context,
-                                              flip_type, axis, FALSE);
+      if (! gimp_drawable_transform_flip (drawable, context,
+                                          flip_type, axis, FALSE))
+        {
+          success = FALSE;
+        }
     }
 }
 CODE
@@ -126,12 +129,14 @@ sub perspective {
       if (progress)
         gimp_progress_start (progress, _("Perspective"), FALSE);
 
-      /* Perspective the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix,
-                                                GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                FALSE, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix,
+                                            GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            FALSE, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -189,12 +194,14 @@ sub rotate {
       if (progress)
         gimp_progress_start (progress, _("Rotating"), FALSE);
 
-      /* Rotate the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix,
-                                                GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                FALSE, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix,
+                                            GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            FALSE, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -263,12 +270,14 @@ sub scale {
       if (progress)
         gimp_progress_start (progress, _("Scaling"), FALSE);
 
-      /* Scale the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix,
-                                                GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                FALSE, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix,
+                                            GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            FALSE, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -329,12 +338,14 @@ sub shear {
       if (progress)
         gimp_progress_start (progress, _("Shearing"), FALSE);
 
-      /* Shear the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix,
-                                                GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                FALSE, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix,
+                                            GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            FALSE, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);
@@ -399,11 +410,13 @@ sub transform_2d {
       if (progress)
         gimp_progress_start (progress, _("2D Transform"), FALSE);
 
-      /* Transform the selection */
-      success = gimp_drawable_transform_affine (drawable, context,
-                                                &matrix, GIMP_TRANSFORM_FORWARD,
-                                                interpolation_type, 3,
-                                                FALSE, progress);
+      if (! gimp_drawable_transform_affine (drawable, context,
+                                            &matrix, GIMP_TRANSFORM_FORWARD,
+                                            interpolation_type, 3,
+                                            FALSE, progress))
+        {
+          success = FALSE;
+        }
 
       if (progress)
         gimp_progress_end (progress);



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