[gegl] buffer: fix use of gegl_tile_handler_damage_rect() for shifted buffers



commit e50a1378a10653eaefb548ac76a268bd3ec44eb0
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 2 12:04:10 2018 -0400

    buffer: fix use of gegl_tile_handler_damage_rect() for shifted buffers
    
    In gegl_buffer_iterate_write() and GeglBufferIterator, shift the
    rectangle passed to gegl_tile_handler_damage_rect() by the buffer's
    shift factor, so that it correctly uses tile-storage coordinates
    for shifted buffers.

 gegl/buffer/gegl-buffer-access.c   |    7 +++++--
 gegl/buffer/gegl-buffer-iterator.c |    9 ++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 34e4435..36fbc52 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -834,8 +834,11 @@ with multi-threading - and should be added back later.
     }
 
   if (level == 0)
-    gegl_tile_handler_damage_rect (GEGL_TILE_HANDLER (buffer->tile_storage),
-                                   roi);
+    {
+      gegl_tile_handler_damage_rect (GEGL_TILE_HANDLER (buffer->tile_storage),
+                                     GEGL_RECTANGLE (buffer_x, buffer_y,
+                                                     width,    height));
+    }
 }
 
 static inline void
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index 9c1ea22..343dd2b 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -553,9 +553,16 @@ _gegl_buffer_iterator_stop (GeglBufferIterator *iter)
               sub->access_mode & GEGL_ACCESS_WRITE &&
               ! (sub->access_mode & GEGL_ITERATOR_INCOMPATIBLE))
             {
+              GeglRectangle damage_rect;
+
+              damage_rect.x      = sub->full_rect.x + sub->buffer->shift_x;
+              damage_rect.y      = sub->full_rect.y + sub->buffer->shift_y;
+              damage_rect.width  = sub->full_rect.width;
+              damage_rect.height = sub->full_rect.height;
+
               gegl_tile_handler_damage_rect (
                 GEGL_TILE_HANDLER (sub->buffer->tile_storage),
-                &sub->full_rect);
+                &damage_rect);
             }
 
           gegl_buffer_unlock (sub->buffer);


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