[gimp] app: use gimp_item_bounds() instead of gimp_channel_bounds() in actions/



commit f54197b68097a4ab259ec562df1ae3969226ae44
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 1 15:19:03 2015 +0200

    app: use gimp_item_bounds() instead of gimp_channel_bounds() in actions/

 app/actions/image-commands.c  |   11 ++++++-----
 app/actions/layers-commands.c |   14 +++++++-------
 2 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 26253e1..fcb3f2b 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -30,7 +30,6 @@
 
 #include "core/core-enums.h"
 #include "core/gimp.h"
-#include "core/gimpchannel.h"
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-convert-precision.h"
@@ -44,6 +43,7 @@
 #include "core/gimpimage-rotate.h"
 #include "core/gimpimage-scale.h"
 #include "core/gimpimage-undo.h"
+#include "core/gimpitem.h"
 #include "core/gimppickable.h"
 #include "core/gimppickable-auto-shrink.h"
 #include "core/gimpprogress.h"
@@ -529,12 +529,13 @@ image_crop_to_selection_cmd_callback (GtkAction *action,
 {
   GimpImage *image;
   GtkWidget *widget;
-  gint       x1, y1, x2, y2;
+  gint       x, y;
+  gint       width, height;
   return_if_no_image (image, data);
   return_if_no_widget (widget, data);
 
-  if (! gimp_channel_bounds (gimp_image_get_mask (image),
-                             &x1, &y1, &x2, &y2))
+  if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
+                          &x, &y, &width, &height))
     {
       gimp_message_literal (image->gimp,
                             G_OBJECT (widget), GIMP_MESSAGE_WARNING,
@@ -543,7 +544,7 @@ image_crop_to_selection_cmd_callback (GtkAction *action,
     }
 
   gimp_image_crop (image, action_data_get_context (data),
-                   x1, y1, x2, y2, TRUE);
+                   x, y, x + width, y + height, TRUE);
   gimp_image_flush (image);
 }
 
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 9852024..8ce3165 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -688,13 +688,14 @@ layers_crop_to_selection_cmd_callback (GtkAction *action,
   GimpImage *image;
   GimpLayer *layer;
   GtkWidget *widget;
-  gint       x1, y1, x2, y2;
+  gint       x, y;
+  gint       width, height;
   gint       off_x, off_y;
   return_if_no_layer (image, layer, data);
   return_if_no_widget (widget, data);
 
-  if (! gimp_channel_bounds (gimp_image_get_mask (image),
-                             &x1, &y1, &x2, &y2))
+  if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
+                          &x, &y, &width, &height))
     {
       gimp_message_literal (image->gimp,
                             G_OBJECT (widget), GIMP_MESSAGE_WARNING,
@@ -703,15 +704,14 @@ layers_crop_to_selection_cmd_callback (GtkAction *action,
     }
 
   gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
-
-  off_x -= x1;
-  off_y -= y1;
+  off_x -= x;
+  off_y -= y;
 
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE,
                                _("Crop Layer to Selection"));
 
   gimp_item_resize (GIMP_ITEM (layer), action_data_get_context (data),
-                    x2 - x1, y2 - y1, off_x, off_y);
+                    width, height, off_x, off_y);
 
   gimp_image_undo_group_end (image);
 


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