[gegl/npd-squashed: 10/17] operations: npd: don't call gegl_buffer_linear_open on the input buffer



commit 896838110fd0989d1ae0c84cf84334ff40022248
Author: Marek Dvoroznak <dvoromar gmail com>
Date:   Fri Dec 6 03:59:27 2013 +0100

    operations: npd: don't call gegl_buffer_linear_open on the input buffer

 libs/npd/npd_gegl.c       |    1 +
 operations/external/npd.c |    9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libs/npd/npd_gegl.c b/libs/npd/npd_gegl.c
index baf3dbe..0d5ea3a 100644
--- a/libs/npd/npd_gegl.c
+++ b/libs/npd/npd_gegl.c
@@ -115,6 +115,7 @@ npd_gegl_init_image (NPDImage   *image,
 {
   image->gegl_buffer = gegl_buffer;
   image->width = gegl_buffer_get_width (gegl_buffer);
+  image->rowstride = image->width * babl_format_get_bytes_per_pixel (format);
   image->height = gegl_buffer_get_height (gegl_buffer);
   image->format = format;
 }
diff --git a/operations/external/npd.c b/operations/external/npd.c
index 0373bf5..542b517 100644
--- a/operations/external/npd.c
+++ b/operations/external/npd.c
@@ -107,12 +107,15 @@ process (GeglOperation       *operation,
                 NULL);
 
       npd_gegl_init_image (input_image, input, format);
-      npd_gegl_open_buffer (input_image);
+      input_image->buffer = g_new0 (guchar, gegl_buffer_get_pixel_count (input) * 4);
+      gegl_buffer_get (input, NULL, 1.0, format, input_image->buffer,
+                       GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
       npd_gegl_init_image (&display->image, output, format);
       npd_gegl_open_buffer (&display->image);
 
       model->display = display;
-      npd_create_model_from_image (model,input_image,
+      npd_create_model_from_image (model, input_image,
                                    input_image->width, input_image->height,
                                    0, 0, o->square_size);
       o->model = model;
@@ -131,14 +134,12 @@ process (GeglOperation       *operation,
           npd_compute_MLS_weights (model);
         }
 
-      npd_gegl_open_buffer (model->reference_image);
       npd_gegl_open_buffer (&display->image);
       memset (display->image.buffer, 0, length);
       npd_deform_model (model, o->rigidity);
       npd_draw_model_into_image (model, &display->image);
     }
 
-  npd_gegl_close_buffer (model->reference_image);
   npd_gegl_close_buffer (&display->image);
 
   return TRUE;


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