[gegl] buffer: match source buffer more closely in gegl_buffer_dup()



commit 897a692fd25c5d88b72ca9e11e625892e9e0b05c
Author: Ell <ell_se yahoo com>
Date:   Fri Sep 21 03:25:39 2018 -0400

    buffer: match source buffer more closely in gegl_buffer_dup()
    
    In gegl_buffer_dup(), use the same abyss, shift, and tile size for
    the duplicated buffer, in addition to the same extent and format,
    so that we use COW even when these properties don't use the default
    values.

 gegl/buffer/gegl-buffer-access.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index e5eeb0171..650e03499 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -2816,9 +2816,25 @@ gegl_buffer_dup (GeglBuffer *buffer)
 
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
 
-  new_buffer = gegl_buffer_new (gegl_buffer_get_extent (buffer), buffer->soft_format);
+  new_buffer = g_object_new (GEGL_TYPE_BUFFER,
+                             "format",       buffer->soft_format,
+                             "x",            buffer->extent.x,
+                             "y",            buffer->extent.y,
+                             "width",        buffer->extent.width,
+                             "height",       buffer->extent.height,
+                             "abyss-x",      buffer->abyss.x,
+                             "abyss-y",      buffer->abyss.y,
+                             "abyss-width",  buffer->abyss.width,
+                             "abyss-height", buffer->abyss.height,
+                             "shift-x",      buffer->shift_x,
+                             "shift-y",      buffer->shift_y,
+                             "tile-width",   buffer->tile_width,
+                             "tile-height",  buffer->tile_height,
+                             NULL);
+
   gegl_buffer_copy (buffer, gegl_buffer_get_extent (buffer), GEGL_ABYSS_NONE,
                     new_buffer, gegl_buffer_get_extent (buffer));
+
   return new_buffer;
 }
 


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