[gimp] Get rid of more x1,y1,x2,y2 uglyness



commit 13cb156a80154c1109a2fde2f67bfd2775f46d2d
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 16 22:59:07 2009 +0200

    Get rid of more x1,y1,x2,y2 uglyness
    
    (gimp_drawable_push_undo): change x1,y1,x2,y2 parameters to
    x,y,witdh,height and update all callers accordingly.

 app/core/gimpdrawable-combine.c |   11 ++++++++---
 app/core/gimpdrawable.c         |   16 +++++++---------
 app/core/gimpdrawable.h         |    8 ++++----
 app/core/gimpimagemap.c         |   12 +++++-------
 app/core/gimpselection.c        |    4 +++-
 app/paint/gimppaintcore.c       |    2 +-
 6 files changed, 28 insertions(+), 25 deletions(-)
---
diff --git a/app/core/gimpdrawable-combine.c b/app/core/gimpdrawable-combine.c
index e1cec8c..b2e8a8b 100644
--- a/app/core/gimpdrawable-combine.c
+++ b/app/core/gimpdrawable-combine.c
@@ -100,8 +100,10 @@ gimp_drawable_real_apply_region (GimpDrawable         *drawable,
     {
       GimpDrawableUndo *undo;
 
-      gimp_drawable_push_undo (drawable,
-                               undo_desc, x1, y1, x2, y2, NULL, FALSE);
+      gimp_drawable_push_undo (drawable, undo_desc,
+                               x1, y1,
+                               x2 - x1, y2 - y1,
+                               NULL, FALSE);
 
       undo = GIMP_DRAWABLE_UNDO (gimp_image_undo_get_fadeable (image));
 
@@ -255,7 +257,10 @@ gimp_drawable_real_replace_region (GimpDrawable *drawable,
 
   /*  If the calling procedure specified an undo step...  */
   if (push_undo)
-    gimp_drawable_push_undo (drawable, undo_desc, x1, y1, x2, y2, NULL, FALSE);
+    gimp_drawable_push_undo (drawable, undo_desc,
+                             x1, y1,
+                             x2 - x1, y2 - y1,
+                             NULL, FALSE);
 
   /* configure the pixel regions */
   pixel_region_init (&src1PR, gimp_drawable_get_tiles (drawable),
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 55f2d8f..3e9f6a5 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1464,16 +1464,14 @@ gimp_drawable_swap_pixels (GimpDrawable *drawable,
 void
 gimp_drawable_push_undo (GimpDrawable *drawable,
                          const gchar  *undo_desc,
-                         gint          x1,
-                         gint          y1,
-                         gint          x2,
-                         gint          y2,
+                         gint          x,
+                         gint          y,
+                         gint          width,
+                         gint          height,
                          TileManager  *tiles,
                          gboolean      sparse)
 {
   GimpItem *item;
-  gint      x, y;
-  gint      width, height;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (sparse == FALSE || tiles != NULL);
@@ -1488,11 +1486,11 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
 
 #if 0
   g_printerr ("gimp_drawable_push_undo (%s, %d, %d, %d, %d)\n",
-              sparse ? "TRUE" : "FALSE", x1, y1, x2 - x1, y2 - y1);
+              sparse ? "TRUE" : "FALSE", x, y, width, height);
 #endif
 
-  if (! gimp_rectangle_intersect (x1, y1,
-                                  x2 - x1, y2 - y1,
+  if (! gimp_rectangle_intersect (x, y,
+                                  width, height,
                                   0, 0,
                                   gimp_item_get_width (item),
                                   gimp_item_get_height (item),
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 36f75f8..e358d12 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -200,10 +200,10 @@ void            gimp_drawable_swap_pixels        (GimpDrawable       *drawable,
 
 void            gimp_drawable_push_undo          (GimpDrawable       *drawable,
                                                   const gchar        *undo_desc,
-                                                  gint                x1,
-                                                  gint                y1,
-                                                  gint                x2,
-                                                  gint                y2,
+                                                  gint                x,
+                                                  gint                y,
+                                                  gint                width,
+                                                  gint                height,
                                                   TileManager        *tiles,
                                                   gboolean            sparse);
 
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index c5d8fe5..94a5da8 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -500,8 +500,6 @@ gimp_image_map_apply (GimpImageMap        *image_map,
 void
 gimp_image_map_commit (GimpImageMap *image_map)
 {
-  gint x1, y1, x2, y2;
-
   g_return_if_fail (GIMP_IS_IMAGE_MAP (image_map));
 
   if (image_map->idle_id)
@@ -520,14 +518,14 @@ gimp_image_map_commit (GimpImageMap *image_map)
   /*  Register an undo step  */
   if (image_map->undo_tiles)
     {
-      x1 = image_map->undo_offset_x;
-      y1 = image_map->undo_offset_y;
-      x2 = x1 + tile_manager_width (image_map->undo_tiles);
-      y2 = y1 + tile_manager_height (image_map->undo_tiles);
+      gint x      = image_map->undo_offset_x;
+      gint y      = image_map->undo_offset_y;
+      gint width  = tile_manager_width  (image_map->undo_tiles);
+      gint height = tile_manager_height (image_map->undo_tiles);
 
       gimp_drawable_push_undo (image_map->drawable,
                                image_map->undo_desc,
-                               x1, y1, x2, y2,
+                               x, y, width, height,
                                image_map->undo_tiles, FALSE);
 
       tile_manager_unref (image_map->undo_tiles);
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 5c037aa..9b197a6 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -710,7 +710,9 @@ gimp_selection_extract (GimpSelection *selection,
     {
       if (cut_image && non_empty)
         gimp_drawable_push_undo (GIMP_DRAWABLE (pickable), NULL,
-                                 x1, y1, x2, y2, NULL, FALSE);
+                                 x1, y1,
+                                 x2 - x1, y2 - y1,
+                                 NULL, FALSE);
 
       gimp_item_get_offset (GIMP_ITEM (pickable), &off_x, &off_y);
       colormap = gimp_drawable_get_colormap (GIMP_DRAWABLE (pickable));
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 32de5a2..3f7a1de 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -436,7 +436,7 @@ gimp_paint_core_finish (GimpPaintCore *core,
 
       gimp_drawable_push_undo (drawable, NULL,
                                core->x1, core->y1,
-                               core->x2, core->y2,
+                               core->x2 - core->x1, core->y2 - core->y1,
                                core->undo_tiles,
                                TRUE);
 



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