[gegl] gegl_node_blit: compute rowstride for GEGL_AUTO_ROWSTRIDE



commit 425cb7be74ece880e6f8dcb8f97929ae6860de9e
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Jul 5 20:37:18 2014 +0200

    gegl_node_blit: compute rowstride for GEGL_AUTO_ROWSTRIDE

 gegl/graph/gegl-node.c        |    4 +++-
 gegl/process/gegl-processor.c |    5 ++---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 51e030d..c6b38e2 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1003,6 +1003,9 @@ gegl_node_blit (GeglNode            *self,
   g_return_if_fail (GEGL_IS_NODE (self));
   g_return_if_fail (roi != NULL);
 
+  if (rowstride == GEGL_AUTO_ROWSTRIDE)
+    rowstride = babl_format_get_bytes_per_pixel (format) * roi->width;
+
   if (!flags)
     {
       GeglBuffer *buffer;
@@ -1018,7 +1021,6 @@ gegl_node_blit (GeglNode            *self,
         {
           buffer = gegl_node_apply_roi (self, roi, 0);
         }
-
       if (buffer && destination_buf)
         gegl_buffer_get (buffer, roi, scale, format, destination_buf, rowstride, GEGL_ABYSS_NONE);
 
diff --git a/gegl/process/gegl-processor.c b/gegl/process/gegl-processor.c
index fd73e2b..6487d74 100644
--- a/gegl/process/gegl-processor.c
+++ b/gegl/process/gegl-processor.c
@@ -490,7 +490,6 @@ render_rectangle (GeglProcessor *processor)
             {
               /* create a buffer and initialise it */
               guchar *buf;
-              gint    rowstride = dr->width * babl_format_get_bytes_per_pixel(format);
 
               buf = g_malloc (dr->width * dr->height * pxsize);
               g_assert (buf);
@@ -500,10 +499,10 @@ render_rectangle (GeglProcessor *processor)
               /* do the image calculations using the buffer */
               gegl_node_blit (processor->input, 1.0/(1<<processor->level),
                               dr, format, buf,
-                              rowstride, GEGL_BLIT_DEFAULT);
+                              GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
 
               /* copy the buffer data into the cache */
-              gegl_buffer_set (GEGL_BUFFER (cache), dr, processor->level, format, buf, rowstride);
+              gegl_buffer_set (GEGL_BUFFER (cache), dr, processor->level, format, buf, GEGL_AUTO_ROWSTRIDE);
 
               /* tells the cache that the rectangle (dr) has been computed */
               gegl_cache_computed (cache, dr);


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