[gimp/goat-invasion: 229/418] app: pass the right undo buffer and extents to gimp_drawable_push_undo()



commit 416d8a7ad805bbb85219e4fa2c380b882f6cffd9
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 23 03:04:14 2012 +0100

    app: pass the right undo buffer and extents to gimp_drawable_push_undo()
    
    the coords need to be in drawable bounds now that we got rid of the
    weird sparse logic.

 app/paint/gimppaintcore.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index e35c583..da6f1c1 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -457,28 +457,30 @@ gimp_paint_core_finish (GimpPaintCore *core,
   if (push_undo)
     {
       GeglBuffer *buffer;
+      gint        x, y, width, height;
+
+      gimp_rectangle_intersect (core->x1, core->y1,
+                                core->x2 - core->x1, core->y2 - core->y1,
+                                0, 0,
+                                gimp_item_get_width  (GIMP_ITEM (drawable)),
+                                gimp_item_get_height (GIMP_ITEM (drawable)),
+                                &x, &y, &width, &height);
 
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_PAINT,
                                    core->undo_desc);
 
       GIMP_PAINT_CORE_GET_CLASS (core)->push_undo (core, image, NULL);
 
-      buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
-                                                     core->x2 - core->x1,
-                                                     core->y2 - core->y1),
+      buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, width, height),
                                      gimp_drawable_get_format (drawable));
 
       gegl_buffer_copy (core->undo_buffer,
-                        GIMP_GEGL_RECT (core->x1, core->y1,
-                                        core->x2 - core->x1,
-                                        core->y2 - core->y1),
+                        GIMP_GEGL_RECT (x, y, width, height),
                         buffer,
                         GIMP_GEGL_RECT (0, 0, 0, 0));
 
       gimp_drawable_push_undo (drawable, NULL,
-                               buffer,
-                               core->x1, core->y1,
-                               core->x2 - core->x1, core->y2 - core->y1);
+                               buffer, x, y, width, height);
 
       g_object_unref (buffer);
 



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