[gimp] pdb: do the same optimization as in the transform tool in the commit below



commit 4d7dbe233de6f8deca76b45121486226765014f7
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 25 21:57:56 2011 +0100

    pdb: do the same optimization as in the transform tool in the commit below

 app/pdb/item-transform-cmds.c       |   29 ++++++++++++++++++++---------
 tools/pdbgen/pdb/item_transform.pdb |   11 ++++++++---
 2 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
index 65969ac..cae3060 100644
--- a/app/pdb/item-transform-cmds.c
+++ b/app/pdb/item-transform-cmds.c
@@ -26,8 +26,10 @@
 #include "pdb-types.h"
 
 #include "core/gimp-transform-utils.h"
+#include "core/gimpchannel.h"
 #include "core/gimpdrawable-transform.h"
 #include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
 #include "core/gimpitem.h"
 #include "core/gimpparamspecs.h"
 #include "core/gimpprogress.h"
@@ -81,7 +83,8 @@ item_transform_flip_simple_invoker (GimpProcedure      *procedure,
                                         flip_type, auto_center, &axis);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -159,7 +162,8 @@ item_transform_flip_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("Flipping"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -258,7 +262,8 @@ item_transform_perspective_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("Perspective"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -341,7 +346,8 @@ item_transform_rotate_simple_invoker (GimpProcedure      *procedure,
                                             auto_center, &center_x, &center_y);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -427,7 +433,8 @@ item_transform_rotate_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("Rotating"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -517,7 +524,8 @@ item_transform_scale_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("Scaling"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -603,7 +611,8 @@ item_transform_shear_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("Shearing"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -700,7 +709,8 @@ item_transform_2d_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("2D Transform"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
@@ -805,7 +815,8 @@ item_transform_matrix_invoker (GimpProcedure      *procedure,
             gimp_progress_start (progress, _("2D Transforming"), FALSE);
 
           if (GIMP_IS_DRAWABLE (item) &&
-              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+              ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+              ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
             {
               GimpDrawable *drawable;
 
diff --git a/tools/pdbgen/pdb/item_transform.pdb b/tools/pdbgen/pdb/item_transform.pdb
index a77cf7f..d80db16 100644
--- a/tools/pdbgen/pdb/item_transform.pdb
+++ b/tools/pdbgen/pdb/item_transform.pdb
@@ -53,7 +53,8 @@ $assemble_matrix
         gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
 
       if (GIMP_IS_DRAWABLE (item) &&
-          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+          ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
         {
           GimpDrawable *drawable;
 
@@ -150,7 +151,8 @@ HELP
                                     flip_type, auto_center, &axis);
 
       if (GIMP_IS_DRAWABLE (item) &&
-          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+          ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
         {
           GimpDrawable *drawable;
 
@@ -356,7 +358,8 @@ HELP
                                         auto_center, &center_x, &center_y);
 
       if (GIMP_IS_DRAWABLE (item) &&
-          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+          ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+          ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
         {
           GimpDrawable *drawable;
 
@@ -657,8 +660,10 @@ CODE
 
 @headers = qw("libgimpmath/gimpmath.h"
               "core/gimp-transform-utils.h"
+              "core/gimpchannel.h"
               "core/gimpdrawable.h"
               "core/gimpdrawable-transform.h"
+              "core/gimpimage.h"
               "core/gimpprogress.h"
               "gimppdb-utils.h"
               "gimppdbcontext.h"



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