[gegl/soc-2013-opecl-ops] buffer: Do gegl_buffer_copy abyss calculations in the dest buffer's format



commit 45defb0daa87547b59bae836714a15686a24c396
Author: Michael Henning <drawoc darkrefraction com>
Date:   Sat Aug 10 22:23:44 2013 -0400

    buffer: Do gegl_buffer_copy abyss calculations in the dest buffer's format
    
    Benefits:
     * Speeds up copying from the abyss.
     * Makes the abyss read as transparent when the dest has alpha and
       the source does not.
     * More consistent with whatever gegl_buffer_iterator does.

 gegl/buffer/gegl-buffer-access.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a0dc9f5..10fd9c1 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1683,7 +1683,6 @@ gegl_buffer_copy2 (GeglBuffer          *src,
                    GeglBuffer          *dst,
                    const GeglRectangle *dst_rect)
 {
-  const Babl *fish;
   g_return_if_fail (GEGL_IS_BUFFER (src));
   g_return_if_fail (GEGL_IS_BUFFER (dst));
 
@@ -1700,22 +1699,20 @@ gegl_buffer_copy2 (GeglBuffer          *src,
   if (src_rect->width == 0 || src_rect->height == 0)
     return;
 
-  fish = babl_fish (src->soft_format, dst->soft_format);
-
     {
       GeglRectangle dest_rect_r = *dst_rect;
       GeglBufferIterator *i;
-      gint read;
+      gint bpp = babl_format_get_bytes_per_pixel (dst->soft_format);
 
       dest_rect_r.width = src_rect->width;
       dest_rect_r.height = src_rect->height;
 
       i = gegl_buffer_iterator_new (dst, &dest_rect_r, 0, dst->soft_format,
                                     GEGL_BUFFER_WRITE, GEGL_ABYSS_NONE);
-      read = gegl_buffer_iterator_add (i, src, src_rect, 0, src->soft_format,
-                                       GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
+      gegl_buffer_iterator_add (i, src, src_rect, 0, dst->soft_format,
+                                GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
       while (gegl_buffer_iterator_next (i))
-        babl_process (fish, i->data[read], i->data[0], i->length);
+        memcpy (i->data[0], i->data[1], i->length * bpp);
     }
 }
 


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