[gimp/goat-invasion: 180/325] app: make use of GIMP_GEGL_RECT in more places



commit a47daf2e69a2c6bb99fd76ef03da4d6a972b3e20
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Wed Mar 21 02:57:53 2012 +0000

    app: make use of GIMP_GEGL_RECT in more places

 app/core/gimp-apply-operation.c     |    6 +---
 app/core/gimpbrush-boundary.c       |    6 +++-
 app/core/gimpchannel-combine.c      |   21 ++++-----------
 app/core/gimpchannel.c              |   27 ++++----------------
 app/core/gimpdrawable-blend.c       |   26 +++++--------------
 app/core/gimpdrawable-offset.c      |   13 +++-------
 app/core/gimpdrawable.c             |   45 ++++++++++------------------------
 app/core/gimpimage-merge.c          |    6 +----
 app/core/gimpimagemap.c             |   17 ++++--------
 app/core/gimplayer.c                |   15 +++--------
 app/core/gimpmaskundo.c             |   22 ++++++++--------
 app/core/gimppattern.c              |   12 ++++-----
 app/core/gimppatternclipboard.c     |    7 +----
 app/core/gimpprojection-construct.c |    3 +-
 app/core/gimpselection.c            |   11 +-------
 app/gegl/gimp-gegl-utils.c          |    7 +----
 16 files changed, 76 insertions(+), 168 deletions(-)
---
diff --git a/app/core/gimp-apply-operation.c b/app/core/gimp-apply-operation.c
index 74c29a8..0ace22a 100644
--- a/app/core/gimp-apply-operation.c
+++ b/app/core/gimp-apply-operation.c
@@ -59,10 +59,8 @@ gimp_apply_operation (GeglBuffer          *src_buffer,
     }
   else
     {
-      rect.x      = 0;
-      rect.y      = 0;
-      rect.width  = gegl_buffer_get_width  (dest_buffer);
-      rect.height = gegl_buffer_get_height (dest_buffer);
+      rect = *GIMP_GEGL_RECT (0, 0, gegl_buffer_get_width  (dest_buffer),
+                                    gegl_buffer_get_height (dest_buffer));
     }
 
   gegl = gegl_node_new ();
diff --git a/app/core/gimpbrush-boundary.c b/app/core/gimpbrush-boundary.c
index 4906950..8d4c465 100644
--- a/app/core/gimpbrush-boundary.c
+++ b/app/core/gimpbrush-boundary.c
@@ -24,6 +24,8 @@
 
 #include "base/temp-buf.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "gimpbezierdesc.h"
 #include "gimpboundary.h"
 #include "gimpbrush.h"
@@ -45,13 +47,13 @@ gimp_brush_transform_boundary_exact (GimpBrush *brush,
   if (mask)
     {
       GeglBuffer    *buffer;
-      GeglRectangle  rect = { 0, 0, mask->width, mask->height };
       GimpBoundSeg  *bound_segs;
       gint           n_bound_segs;
 
       buffer = gegl_buffer_linear_new_from_data (mask->data,
                                                  babl_format ("Y u8"),
-                                                 &rect,
+                                                 GIMP_GEGL_RECT (0,0,mask->width,
+                                                                     mask->height),
                                                  GEGL_AUTO_ROWSTRIDE,
                                                  NULL, NULL);
 
diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c
index 96fd5f6..8461cb5 100644
--- a/app/core/gimpchannel-combine.c
+++ b/app/core/gimpchannel-combine.c
@@ -26,6 +26,8 @@
 
 #include "core-types.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "gimpchannel.h"
 #include "gimpchannel-combine.h"
 
@@ -39,7 +41,6 @@ gimp_channel_combine_rect (GimpChannel    *mask,
                            gint            h)
 {
   GeglColor     *color;
-  GeglRectangle  rect;
 
   g_return_if_fail (GIMP_IS_CHANNEL (mask));
 
@@ -55,13 +56,8 @@ gimp_channel_combine_rect (GimpChannel    *mask,
   else
     color = gegl_color_new ("#000");
 
-  rect.x      = x;
-  rect.y      = y;
-  rect.width  = w;
-  rect.height = h;
-
   gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
-                         &rect, color);
+                         GIMP_GEGL_RECT (x, y, w, h), color);
   g_object_unref (color);
 
   /*  Determine new boundary  */
@@ -211,7 +207,6 @@ gimp_channel_combine_ellipse_rect (GimpChannel    *mask,
   GeglBuffer         *buffer;
   GeglBufferIterator *iter;
   GeglRectangle      *roi;
-  GeglRectangle       rect;
   gint                bpp;
   gdouble             a_sqr;
   gdouble             b_sqr;
@@ -239,15 +234,11 @@ gimp_channel_combine_ellipse_rect (GimpChannel    *mask,
 
   ellipse_center_x = x + a;
 
-  rect.x      = x0;
-  rect.y      = y0;
-  rect.width  = width;
-  rect.height = height;
-
   buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
 
-  iter = gegl_buffer_iterator_new (buffer, &rect, babl_format ("Y u8"),
-                                   GEGL_BUFFER_READWRITE);
+  iter = gegl_buffer_iterator_new (buffer,
+                                   GIMP_GEGL_RECT (x0, y0, width, height),
+                                   babl_format ("Y u8"), GEGL_BUFFER_READWRITE);
   roi = &iter->roi[0];
   bpp = 1;
 
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 51187c3..d7c603f 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -515,8 +515,6 @@ gimp_channel_translate (GimpItem *item,
   GimpChannel   *tmp_mask   = NULL;
   GeglBuffer    *tmp_buffer = NULL;
   gint           width, height;
-  GeglRectangle  src_rect;
-  GeglRectangle  dest_rect;
   gint           x1, y1, x2, y2;
 
   gimp_channel_bounds (channel, &x1, &y1, &x2, &y2);
@@ -547,18 +545,10 @@ gimp_channel_translate (GimpItem *item,
                                         width, height);
       tmp_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (tmp_mask));
 
-      src_rect.x      = x1 - off_x;
-      src_rect.y      = y1 - off_y;
-      src_rect.width  = width;
-      src_rect.height = height;
-
-      dest_rect.x = 0;
-      dest_rect.y = 0;
-
       gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
-                        &src_rect,
+                        GIMP_GEGL_RECT (x1 - off_x, y1 - off_y, width, height),
                         tmp_buffer,
-                        &dest_rect);
+                        GIMP_GEGL_RECT (0,0,0,0));
     }
 
   /*  clear the mask  */
@@ -568,13 +558,11 @@ gimp_channel_translate (GimpItem *item,
   if (width != 0 && height != 0)
     {
       /*  copy the temp mask back to the mask  */
-      dest_rect.x = x1;
-      dest_rect.y = y1;
 
       gegl_buffer_copy (tmp_buffer,
                         NULL,
                         gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
-                        &dest_rect);
+                        GIMP_GEGL_RECT (x1, y1, 0, 0));
 
       /*  free the temporary mask  */
       g_object_unref (tmp_mask);
@@ -1323,13 +1311,10 @@ gimp_channel_real_clear (GimpChannel *channel,
 
   if (channel->bounds_known && ! channel->empty)
     {
-      GeglRectangle rect = { channel->x1,
-                             channel->y1,
-                             channel->x2 - channel->x1,
-                             channel->y2 - channel->y1 };
-
       gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
-                         &rect);
+                         GIMP_GEGL_RECT (channel->x1, channel->y1,
+                                         channel->x2 - channel->x1,
+                                         channel->y2 - channel->y1));
     }
   else
     {
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index b1bd9d9..3af8153 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -589,8 +589,6 @@ gradient_precalc_shapeburst (GimpImage    *image,
   /*  If the image mask is not empty, use it as the shape burst source  */
   if (! gimp_channel_is_empty (mask))
     {
-      GeglRectangle  src_rect;
-      GeglRectangle  dest_rect = { 0, };
       gint           x, y, width, height;
       gint           off_x, off_y;
 
@@ -600,35 +598,25 @@ gradient_precalc_shapeburst (GimpImage    *image,
       temp_buffer = gimp_tile_manager_create_buffer (temp_tiles,
                                                      babl_format ("Y u8"));
 
-      src_rect.x      = x + off_x;
-      src_rect.y      = y + off_y;
-      src_rect.width  = width;
-      src_rect.height = height;
-
       /*  copy the mask to the temp mask  */
       gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
-                        &src_rect,
-                        temp_buffer, &dest_rect);
+                        GIMP_GEGL_RECT (x+off_x, y + off_y, width, height),
+                        temp_buffer,
+                        GIMP_GEGL_RECT (0,0,0,0));
     }
   else
     {
       /*  If the intended drawable has an alpha channel, use that  */
       if (gimp_drawable_has_alpha (drawable))
         {
-          GeglRectangle  src_rect;
-          GeglRectangle  dest_rect = { 0, };
-
           temp_buffer = gimp_tile_manager_create_buffer (temp_tiles,
                                                          babl_format ("A u8"));
 
-          src_rect.x      = PR->x;
-          src_rect.y      = PR->y;
-          src_rect.width  = PR->w;
-          src_rect.height = PR->h;
-
           /*  extract the aplha into the temp mask  */
-          gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                            temp_buffer, &dest_rect);
+          gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
+                            GIMP_GEGL_RECT (PR->x, PR->y, PR->w, PR->h),
+                            temp_buffer,
+                            GIMP_GEGL_RECT (0,0,0,0));
         }
       else
         {
diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c
index 51d4f1d..83d9a41 100644
--- a/app/core/gimpdrawable-offset.c
+++ b/app/core/gimpdrawable-offset.c
@@ -182,15 +182,10 @@ gimp_drawable_offset (GimpDrawable   *drawable,
       /*  intersecting region  */
       if (offset_x != 0 && offset_y != 0)
         {
-          src_rect.x      = src_x;
-          src_rect.y      = src_y;
-          src_rect.width  = ABS (offset_x);
-          src_rect.height = ABS (offset_y);
-
-          dest_rect.x = dest_x;
-          dest_rect.y = dest_y;
-
-          gegl_buffer_copy (src_buffer, &src_rect, dest_buffer, &dest_rect);
+          gegl_buffer_copy (src_buffer,
+              GIMP_GEGL_RECT (src_x, src_y, ABS(offset_x), ABS(offset_y)),
+              dest_buffer,
+              GIMP_GEGL_RECT (dest_x, dest_y, 0, 0));
         }
 
       /*  X offset  */
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index e70b0d4..ee85859 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -600,21 +600,14 @@ gimp_drawable_resize (GimpItem    *item,
   if (copy_width && copy_height)
     {
       /*  Copy the pixels in the intersection  */
-
-      GeglRectangle  src_rect;
-      GeglRectangle  dest_rect;
-
-      src_rect.x      = copy_x - gimp_item_get_offset_x (item);
-      src_rect.y      = copy_y - gimp_item_get_offset_y (item);
-      src_rect.width  = copy_width;
-      src_rect.height = copy_height;
-
-      dest_rect.x = copy_x - new_offset_x;
-      dest_rect.y = copy_y - new_offset_y;
-
-      gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                        dest_buffer, &dest_rect);
-
+      gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
+                        GIMP_GEGL_RECT (copy_x - gimp_item_get_offset_x (item),
+                                        copy_y - gimp_item_get_offset_y (item),
+                                        copy_width,
+                                        copy_height),
+                        dest_buffer,
+                        GIMP_GEGL_RECT (copy_x - new_offset_x,
+                                        copy_y - new_offset_y, 0, 0));
     }
 
   g_object_unref (dest_buffer);
@@ -763,14 +756,8 @@ gimp_drawable_real_update (GimpDrawable *drawable,
 
       if (operation)
         {
-          GeglRectangle rect;
-
-          rect.x      = x;
-          rect.y      = y;
-          rect.width  = width;
-          rect.height = height;
-
-          gegl_operation_invalidate (GEGL_OPERATION (operation), &rect, FALSE);
+          gegl_operation_invalidate (GEGL_OPERATION (operation),
+                                     GIMP_GEGL_RECT (x,y,width,height), FALSE);
           g_object_unref (operation);
         }
     }
@@ -922,21 +909,15 @@ gimp_drawable_real_push_undo (GimpDrawable *drawable,
   if (! tiles)
     {
       GeglBuffer    *dest_buffer;
-      GeglRectangle  src_rect;
-      GeglRectangle  dest_rect = { 0, };
 
       tiles = tile_manager_new (width, height, gimp_drawable_bytes (drawable));
 
       dest_buffer = gimp_tile_manager_create_buffer (tiles,
                                                      gimp_drawable_get_format (drawable));
 
-      src_rect.x      = x;
-      src_rect.y      = y;
-      src_rect.width  = width;
-      src_rect.height = height;
-
-      gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                        dest_buffer, &dest_rect);
+      gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
+                        GIMP_GEGL_RECT (x,y,width,height),
+                        dest_buffer, GIMP_GEGL_RECT (0,0,0,0));
 
       g_object_unref (dest_buffer);
 
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index cb7e395..f53cfe0 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -521,7 +521,6 @@ gimp_image_merge_layers (GimpImage     *image,
       gimp_drawable_type (GIMP_DRAWABLE (layer)) == GIMP_INDEXED_IMAGE)
     {
       GeglColor     *color;
-      GeglRectangle  rect = { 0, };
       GimpImageType  type;
       GimpRGB        bg;
 
@@ -542,12 +541,9 @@ gimp_image_merge_layers (GimpImage     *image,
       /*  get the background for compositing  */
       gimp_context_get_background (context, &bg);
 
-      rect.width  = x2 - x1;
-      rect.height = y2 - y1;
-
       color = gimp_gegl_color_new (&bg);
       gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer)),
-                             &rect, color);
+                             GIMP_GEGL_RECT(0,0,x2-x1,y2-y1), color);
       g_object_unref (color);
 
       position = 0;
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index 4892a46..6f091da 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -880,22 +880,17 @@ gimp_image_map_data_written (GObject             *operation,
 
       GeglBuffer    *src;
       GeglBuffer    *dest;
-      GeglRectangle  src_rect;
-      GeglRectangle  dest_rect;
 
       src = gimp_tile_manager_create_buffer (image_map->undo_tiles,
                                              gimp_drawable_get_format (image_map->drawable));
       dest = gimp_drawable_get_buffer (image_map->drawable);
 
-      src_rect.x      = extent->x - image_map->undo_offset_x;
-      src_rect.y      = extent->y - image_map->undo_offset_y;
-      src_rect.width  = extent->width;
-      src_rect.height = extent->height;
-
-      dest_rect.x = extent->x;
-      dest_rect.y = extent->y;
-
-      gegl_buffer_copy (src, &src_rect, dest, &dest_rect);
+      gegl_buffer_copy (src,
+            GIMP_GEGL_RECT (extent->x - image_map->undo_offset_x,
+                            extent->y - image_map->undo_offset_y,
+                            extent->width, extent->height),
+                        dest,
+            GIMP_GEGL_RECT (extent->x, extent->y, 0, 0));
 
       g_object_unref (src);
     }
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 10623a8..8f15545 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1461,21 +1461,14 @@ gimp_layer_create_mask (const GimpLayer *layer,
           {
             GeglBuffer    *src;
             GeglBuffer    *dest;
-            GeglRectangle  src_rect;
-            GeglRectangle  dest_rect;
 
             src  = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
             dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
 
-            src_rect.x      = copy_x;
-            src_rect.y      = copy_y;
-            src_rect.width  = copy_width;
-            src_rect.height = copy_height;
-
-            dest_rect.x = copy_x - offset_x;
-            dest_rect.y = copy_y - offset_y;
-
-            gegl_buffer_copy (src, &src_rect, dest, &dest_rect);
+            gegl_buffer_copy (src,
+                     GIMP_GEGL_RECT (copy_x, copy_y, copy_width, copy_height),
+                     dest,
+                     GIMP_GEGL_RECT (copy_x-offset_x, copy_y-offset_y, 0, 0));
 
             GIMP_CHANNEL (mask)->bounds_known = FALSE;
           }
diff --git a/app/core/gimpmaskundo.c b/app/core/gimpmaskundo.c
index 61679ea..22ff6ee 100644
--- a/app/core/gimpmaskundo.c
+++ b/app/core/gimpmaskundo.c
@@ -21,6 +21,8 @@
 
 #include "core-types.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "gimpchannel.h"
 #include "gimpmaskundo.h"
 
@@ -79,17 +81,17 @@ gimp_mask_undo_constructed (GObject *object)
   if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
     {
       GimpDrawable  *drawable    = GIMP_DRAWABLE (channel);
-      GeglRectangle  buffer_rect = { 0, 0, x2 - x1, y2 - y1 };
-      GeglRectangle  src_rect    = { x1, y1, x2 - x1, y2 - y1 };
-      GeglRectangle  dest_rect   = { 0, };
 
-      mask_undo->buffer = gegl_buffer_new (&buffer_rect,
+      mask_undo->buffer = gegl_buffer_new (GIMP_GEGL_RECT(0,0,x2-x1, y2-y1),
                                            babl_format ("Y float"));
+
+      gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
+                        GIMP_GEGL_RECT (x1, y1, x2 - x1, y2 - y1),
+                        mask_undo->buffer, 
+                        GIMP_GEGL_RECT (0, 0, 0, 0));
+
       mask_undo->x = x1;
       mask_undo->y = y1;
-
-      gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                        mask_undo->buffer, &dest_rect);
     }
 }
 
@@ -123,15 +125,13 @@ gimp_mask_undo_pop (GimpUndo            *undo,
 
   if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
     {
-      GeglRectangle  buffer_rect = { 0, 0, x2 - x1, y2 - y1 };
       GeglRectangle  src_rect    = { x1, y1, x2 - x1, y2 - y1 };
-      GeglRectangle  dest_rect   = { 0, };
 
-      new_buffer = gegl_buffer_new (&buffer_rect,
+      new_buffer = gegl_buffer_new (GIMP_GEGL_RECT (0, 0, x2 - x1, y2 - y1),
                                     babl_format ("Y float"));
 
       gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                        new_buffer, &dest_rect);
+                        new_buffer, GIMP_GEGL_RECT (0,0,0,0));
 
       gegl_buffer_clear (gimp_drawable_get_buffer (drawable), &src_rect);
     }
diff --git a/app/core/gimppattern.c b/app/core/gimppattern.c
index 21e2e33..6bf163c 100644
--- a/app/core/gimppattern.c
+++ b/app/core/gimppattern.c
@@ -269,19 +269,17 @@ gimp_pattern_get_mask (const GimpPattern *pattern)
 GeglBuffer *
 gimp_pattern_create_buffer (const GimpPattern *pattern)
 {
-  GeglRectangle rect = { 0, };
-  gint          bytes;
+  gint width, height, bytes;
 
   g_return_val_if_fail (GIMP_IS_PATTERN (pattern), NULL);
 
-  rect.width  = pattern->mask->width;
-  rect.height = pattern->mask->height;
-
+  width = pattern->mask->width;
+  height = pattern->mask->height;
   bytes = pattern->mask->bytes;
 
   return gegl_buffer_linear_new_from_data (temp_buf_get_data (pattern->mask),
                                            gimp_bpp_to_babl_format (bytes, TRUE),
-                                           &rect,
-                                           rect.width * bytes,
+                                           GIMP_GEGL_RECT(0,0,width,height),
+                                           width * bytes,
                                            NULL, NULL);
 }
diff --git a/app/core/gimppatternclipboard.c b/app/core/gimppatternclipboard.c
index b9e4620..4e8fdac 100644
--- a/app/core/gimppatternclipboard.c
+++ b/app/core/gimppatternclipboard.c
@@ -189,7 +189,6 @@ gimp_pattern_clipboard_buffer_changed (Gimp        *gimp,
   if (gimp->global_buffer)
     {
       GimpBuffer    *buffer = gimp->global_buffer;
-      GeglRectangle  rect = { 0, };
       gint           width;
       gint           height;
       gint           bytes;
@@ -198,12 +197,10 @@ gimp_pattern_clipboard_buffer_changed (Gimp        *gimp,
       height = MIN (gimp_buffer_get_height (buffer), 512);
       bytes  = gimp_buffer_get_bytes (buffer);
 
-      rect.width  = width;
-      rect.height = height;
-
       pattern->mask = temp_buf_new (width, height, bytes, 0, 0, NULL);
 
-      gegl_buffer_get (gimp_buffer_get_buffer (buffer), 1.0, &rect,
+      gegl_buffer_get (gimp_buffer_get_buffer (buffer), 1.0,
+                       GIMP_GEGL_RECT (0,0,width,height),
                        gimp_bpp_to_babl_format (bytes, TRUE),
                        temp_buf_get_data (pattern->mask),
                        width * gimp_buffer_get_bytes (buffer));
diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c
index cf24750..99cb60f 100644
--- a/app/core/gimpprojection-construct.c
+++ b/app/core/gimpprojection-construct.c
@@ -252,7 +252,6 @@ gimp_projection_initialize (GimpProjection *proj,
   if (! coverage)
     {
       GeglBuffer    *buffer;
-      GeglRectangle  rect = { x, y, w, h };
 
       if (proj->use_gegl)
         {
@@ -267,7 +266,7 @@ gimp_projection_initialize (GimpProjection *proj,
           buffer = gimp_tile_manager_create_buffer (tiles, NULL);
         }
 
-      gegl_buffer_clear (buffer, &rect);
+      gegl_buffer_clear (buffer, GIMP_GEGL_RECT (x, y, w, h));
       g_object_unref (buffer);
     }
 }
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index f0e047a..71e2b4d 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -630,8 +630,6 @@ gimp_selection_extract (GimpSelection *selection,
   TileManager       *tiles;
   GeglBuffer        *src_buffer;
   GeglBuffer        *dest_buffer;
-  GeglRectangle      src_rect;
-  GeglRectangle      dest_rect = { 0, };
   gint               x1, y1, x2, y2;
   gboolean           non_empty;
   gint               off_x, off_y;
@@ -720,19 +718,14 @@ gimp_selection_extract (GimpSelection *selection,
 
   src_buffer = gimp_pickable_get_buffer (pickable);
 
-  src_rect.x      = x1;
-  src_rect.y      = y1;
-  src_rect.width  = x2 - x1;
-  src_rect.height = y2 - y1;
-
   /*  Allocate the temp buffer  */
   tiles = tile_manager_new (x2 - x1, y2 - y1,
                             babl_format_get_bytes_per_pixel (*format));
   dest_buffer = gimp_tile_manager_create_buffer (tiles, *format);
 
   /*  First, copy the pixels, possibly doing INDEXED->RGB and adding alpha  */
-  gegl_buffer_copy (src_buffer, &src_rect,
-                    dest_buffer, &dest_rect);
+  gegl_buffer_copy (src_buffer, GIMP_GEGL_RECT (x1, y1, x2 - x1, y2 - y1),
+                    dest_buffer, GIMP_GEGL_RECT (0,0,0,0));
 
   if (non_empty)
     {
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index 3bf818f..bf3aef5 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -183,7 +183,6 @@ gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf)
   gint          height;
   gint          rowstride;
   gint          channels;
-  GeglRectangle rect = { 0, };
 
   g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
 
@@ -192,13 +191,11 @@ gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf)
   rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   channels  = gdk_pixbuf_get_n_channels (pixbuf);
 
-  rect.width = width;
-  rect.height = height;
-
   return gegl_buffer_linear_new_from_data (gdk_pixbuf_get_pixels (pixbuf),
                                            gimp_bpp_to_babl_format (channels,
                                                                     TRUE),
-                                           &rect, rowstride,
+                                           GIMP_GEGL_RECT (0,0,width,height),
+                                           rowstride,
                                            (GDestroyNotify) g_object_unref,
                                            g_object_ref (pixbuf));
 }



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