[gimp/goat-invasion: 211/418] app: remove width, height from GimpDrawableUndo and GimpDrawable::swap_tiles()



commit 646f8e154cd606c3c2a48a0b60ba95b6ddab4bea
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 22 14:25:45 2012 +0100

    app: remove width, height from GimpDrawableUndo and GimpDrawable::swap_tiles()
    
    because we always store/swap a buffer of the actual size now.

 app/core/gimp-edit.c           |    3 ++-
 app/core/gimpchannel.c         |   11 +++--------
 app/core/gimpdrawable.c        |   20 +++++++-------------
 app/core/gimpdrawable.h        |    8 ++------
 app/core/gimpdrawableundo.c    |   32 ++------------------------------
 app/core/gimpdrawableundo.h    |    2 --
 app/core/gimpimage-undo-push.c |    6 +-----
 app/core/gimpimage-undo-push.h |    4 +---
 8 files changed, 18 insertions(+), 68 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 2be178a..d28ad81 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -547,7 +547,8 @@ gimp_edit_fade (GimpImage   *image,
 
       pixel_region_init (&src2PR, src2_tiles,
                          0, 0,
-                         undo->width, undo->height,
+                         gegl_buffer_get_width (undo->buffer),
+                         gegl_buffer_get_height (undo->buffer),
                          FALSE);
 
       gimp_drawable_apply_region (drawable, &src2PR,
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 2a03c2a..658d490 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -166,9 +166,7 @@ static GeglNode * gimp_channel_get_node      (GimpItem            *item);
 static void      gimp_channel_swap_pixels    (GimpDrawable        *drawable,
                                               GeglBuffer          *buffer,
                                               gint                 x,
-                                              gint                 y,
-                                              gint                 width,
-                                              gint                 height);
+                                              gint                 y);
 
 static gint      gimp_channel_get_opacity_at (GimpPickable        *pickable,
                                               gint                 x,
@@ -935,14 +933,11 @@ static void
 gimp_channel_swap_pixels (GimpDrawable *drawable,
                           GeglBuffer   *buffer,
                           gint          x,
-                          gint          y,
-                          gint          width,
-                          gint          height)
+                          gint          y)
 {
   gimp_drawable_invalidate_boundary (drawable);
 
-  GIMP_DRAWABLE_CLASS (parent_class)->swap_pixels (drawable, buffer,
-                                                   x, y, width, height);
+  GIMP_DRAWABLE_CLASS (parent_class)->swap_pixels (drawable, buffer, x, y);
 
   GIMP_CHANNEL (drawable)->bounds_known = FALSE;
 }
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index fa002f6..6029b7c 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -160,9 +160,7 @@ static void       gimp_drawable_real_push_undo     (GimpDrawable      *drawable,
 static void       gimp_drawable_real_swap_pixels   (GimpDrawable      *drawable,
                                                     GeglBuffer        *buffer,
                                                     gint               x,
-                                                    gint               y,
-                                                    gint               width,
-                                                    gint               height);
+                                                    gint               y);
 
 static void       gimp_drawable_sync_source_node   (GimpDrawable      *drawable,
                                                     gboolean           detach_fs);
@@ -885,8 +883,7 @@ gimp_drawable_real_push_undo (GimpDrawable *drawable,
 
   gimp_image_undo_push_drawable (gimp_item_get_image (GIMP_ITEM (drawable)),
                                  undo_desc, drawable,
-                                 buffer,
-                                 x, y, width, height);
+                                 buffer, x, y);
 
   g_object_unref (buffer);
 }
@@ -895,11 +892,11 @@ static void
 gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
                                 GeglBuffer   *buffer,
                                 gint          x,
-                                gint          y,
-                                gint          width,
-                                gint          height)
+                                gint          y)
 {
   GeglBuffer *tmp;
+  gint        width  = gegl_buffer_get_width (buffer);
+  gint        height = gegl_buffer_get_height (buffer);
 
   tmp = gimp_gegl_buffer_dup (buffer);
 
@@ -1530,15 +1527,12 @@ void
 gimp_drawable_swap_pixels (GimpDrawable *drawable,
                            GeglBuffer   *buffer,
                            gint          x,
-                           gint          y,
-                           gint          width,
-                           gint          height)
+                           gint          y)
 {
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
 
-  GIMP_DRAWABLE_GET_CLASS (drawable)->swap_pixels (drawable, buffer,
-                                                   x, y, width, height);
+  GIMP_DRAWABLE_GET_CLASS (drawable)->swap_pixels (drawable, buffer, x, y);
 }
 
 void
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 26a4097..d268446 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -105,9 +105,7 @@ struct _GimpDrawableClass
   void          (* swap_pixels)           (GimpDrawable         *drawable,
                                            GeglBuffer           *buffer,
                                            gint                  x,
-                                           gint                  y,
-                                           gint                  width,
-                                           gint                  height);
+                                           gint                  y);
 };
 
 
@@ -195,9 +193,7 @@ GeglNode      * gimp_drawable_get_mode_node      (GimpDrawable       *drawable);
 void            gimp_drawable_swap_pixels        (GimpDrawable       *drawable,
                                                   GeglBuffer         *buffer,
                                                   gint                x,
-                                                  gint                y,
-                                                  gint                width,
-                                                  gint                height);
+                                                  gint                y);
 
 void            gimp_drawable_push_undo          (GimpDrawable       *drawable,
                                                   const gchar        *undo_desc,
diff --git a/app/core/gimpdrawableundo.c b/app/core/gimpdrawableundo.c
index 7340707..d768d9e 100644
--- a/app/core/gimpdrawableundo.c
+++ b/app/core/gimpdrawableundo.c
@@ -36,9 +36,7 @@ enum
   PROP_0,
   PROP_BUFFER,
   PROP_X,
-  PROP_Y,
-  PROP_WIDTH,
-  PROP_HEIGHT
+  PROP_Y
 };
 
 
@@ -100,18 +98,6 @@ gimp_drawable_undo_class_init (GimpDrawableUndoClass *klass)
                                                      0, GIMP_MAX_IMAGE_SIZE, 0,
                                                      GIMP_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class, PROP_WIDTH,
-                                   g_param_spec_int ("width", NULL, NULL,
-                                                     0, GIMP_MAX_IMAGE_SIZE, 0,
-                                                     GIMP_PARAM_READWRITE |
-                                                     G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class, PROP_HEIGHT,
-                                   g_param_spec_int ("height", NULL, NULL,
-                                                     0, GIMP_MAX_IMAGE_SIZE, 0,
-                                                     GIMP_PARAM_READWRITE |
-                                                     G_PARAM_CONSTRUCT_ONLY));
 }
 
 static void
@@ -150,12 +136,6 @@ gimp_drawable_undo_set_property (GObject      *object,
     case PROP_Y:
       drawable_undo->y = g_value_get_int (value);
       break;
-    case PROP_WIDTH:
-      drawable_undo->width = g_value_get_int (value);
-      break;
-    case PROP_HEIGHT:
-      drawable_undo->height = g_value_get_int (value);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -182,12 +162,6 @@ gimp_drawable_undo_get_property (GObject    *object,
     case PROP_Y:
       g_value_set_int (value, drawable_undo->y);
       break;
-    case PROP_WIDTH:
-      g_value_set_int (value, drawable_undo->width);
-      break;
-    case PROP_HEIGHT:
-      g_value_set_int (value, drawable_undo->height);
-      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -220,9 +194,7 @@ gimp_drawable_undo_pop (GimpUndo            *undo,
   gimp_drawable_swap_pixels (GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item),
                              drawable_undo->buffer,
                              drawable_undo->x,
-                             drawable_undo->y,
-                             drawable_undo->width,
-                             drawable_undo->height);
+                             drawable_undo->y);
 }
 
 static void
diff --git a/app/core/gimpdrawableundo.h b/app/core/gimpdrawableundo.h
index a16c7b1..aaf0717 100644
--- a/app/core/gimpdrawableundo.h
+++ b/app/core/gimpdrawableundo.h
@@ -39,8 +39,6 @@ struct _GimpDrawableUndo
   GeglBuffer   *buffer;
   gint          x;
   gint          y;
-  gint          width;
-  gint          height;
 
   /* stuff for "Fade" */
   TileManager          *src2_tiles;
diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c
index 6a4c161..aed00ee 100644
--- a/app/core/gimpimage-undo-push.c
+++ b/app/core/gimpimage-undo-push.c
@@ -211,9 +211,7 @@ gimp_image_undo_push_drawable (GimpImage    *image,
                                GimpDrawable *drawable,
                                GeglBuffer   *buffer,
                                gint          x,
-                               gint          y,
-                               gint          width,
-                               gint          height)
+                               gint          y)
 {
   GimpItem *item;
 
@@ -232,8 +230,6 @@ gimp_image_undo_push_drawable (GimpImage    *image,
                                "buffer", buffer,
                                "x",      x,
                                "y",      y,
-                               "width",  width,
-                               "height", height,
                                NULL);
 }
 
diff --git a/app/core/gimpimage-undo-push.h b/app/core/gimpimage-undo-push.h
index 31a2a8a..7aab4bb 100644
--- a/app/core/gimpimage-undo-push.h
+++ b/app/core/gimpimage-undo-push.h
@@ -61,9 +61,7 @@ GimpUndo * gimp_image_undo_push_drawable            (GimpImage     *image,
                                                      GimpDrawable  *drawable,
                                                      GeglBuffer    *buffer,
                                                      gint           x,
-                                                     gint           y,
-                                                     gint           width,
-                                                     gint           height);
+                                                     gint           y);
 GimpUndo * gimp_image_undo_push_drawable_mod        (GimpImage     *image,
                                                      const gchar   *undo_desc,
                                                      GimpDrawable  *drawable,



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