[gimp] app: clean up GimpMaskUndo's GeglRectangle code



commit 85b83b65ff0b30c8d67cd61baed9d150ec1b2b5c
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 22 15:44:38 2012 +0200

    app: clean up GimpMaskUndo's GeglRectangle code

 app/core/gimpmaskundo.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpmaskundo.c b/app/core/gimpmaskundo.c
index 737ac01..32bc4ce 100644
--- a/app/core/gimpmaskundo.c
+++ b/app/core/gimpmaskundo.c
@@ -81,9 +81,10 @@ gimp_mask_undo_constructed (GObject *object)
 
   if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
     {
-      GimpDrawable  *drawable    = GIMP_DRAWABLE (channel);
+      GimpDrawable *drawable = GIMP_DRAWABLE (channel);
 
-      mask_undo->buffer = gegl_buffer_new (GEGL_RECTANGLE(0,0,x2-x1, y2-y1),
+      mask_undo->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
+                                                           x2 - x1, y2 - y1),
                                            babl_format ("Y float"));
 
       gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
@@ -126,15 +127,16 @@ gimp_mask_undo_pop (GimpUndo            *undo,
 
   if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
     {
-      GeglRectangle  src_rect    = { x1, y1, x2 - x1, y2 - y1 };
-
       new_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, x2 - x1, y2 - y1),
                                     babl_format ("Y float"));
 
-      gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
-                        new_buffer, GEGL_RECTANGLE (0,0,0,0));
+      gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
+                        GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
+                        new_buffer,
+                        GEGL_RECTANGLE (0, 0, 0, 0));
 
-      gegl_buffer_clear (gimp_drawable_get_buffer (drawable), &src_rect);
+      gegl_buffer_clear (gimp_drawable_get_buffer (drawable),
+                         GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1));
     }
   else
     {
@@ -143,13 +145,13 @@ gimp_mask_undo_pop (GimpUndo            *undo,
 
   if (mask_undo->buffer)
     {
-      GeglRectangle  dest_rect = { mask_undo->x, mask_undo->y, 0, 0 };
-
       width  = gegl_buffer_get_width  (mask_undo->buffer);
       height = gegl_buffer_get_height (mask_undo->buffer);
 
-      gegl_buffer_copy (mask_undo->buffer, NULL,
-                        gimp_drawable_get_buffer (drawable), &dest_rect);
+      gegl_buffer_copy (mask_undo->buffer,
+                        NULL,
+                        gimp_drawable_get_buffer (drawable),
+                        GEGL_RECTANGLE (mask_undo->x, mask_undo->y, 0, 0));
 
       g_object_unref (mask_undo->buffer);
     }



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