[gegl] noise-slur: use a sampler instead of gegl_buffer_sample_at_level



commit 54af4d9fceef3064d7460f65e1fa46363719817e
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Oct 12 02:39:44 2017 +0200

    noise-slur: use a sampler instead of gegl_buffer_sample_at_level
    
    since gegl_buffer_sample_at_level isn't thread safe.

 operations/common-gpl3+/noise-slur.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/operations/common-gpl3+/noise-slur.c b/operations/common-gpl3+/noise-slur.c
index 169bdb9..8656f53 100644
--- a/operations/common-gpl3+/noise-slur.c
+++ b/operations/common-gpl3+/noise-slur.c
@@ -81,6 +81,7 @@ process (GeglOperation       *operation,
   const Babl         *format;
   gint                bpp;
   GeglBufferIterator *gi;
+  GeglSampler        *sampler;
 
   o = GEGL_PROPERTIES (operation);
 
@@ -90,6 +91,8 @@ process (GeglOperation       *operation,
   gi = gegl_buffer_iterator_new (output, result, 0, format,
                                  GEGL_ACCESS_WRITE, GEGL_ABYSS_CLAMP);
 
+  sampler = gegl_buffer_sampler_new_at_level (input, format, GEGL_SAMPLER_NEAREST, level);
+
   while (gegl_buffer_iterator_next (gi))
     {
       gchar        *data = gi->data[0];
@@ -127,13 +130,13 @@ process (GeglOperation       *operation,
                   }
               }
 
-            gegl_buffer_sample_at_level (input, pos_x, pos_y, NULL, data, format,
-                                level,
-                                GEGL_SAMPLER_NEAREST, GEGL_ABYSS_CLAMP);
+            gegl_sampler_get (sampler, pos_x, pos_y, NULL, data, GEGL_ABYSS_CLAMP);
             data += bpp;
           }
     }
 
+  g_object_unref (sampler);
+
   return TRUE;
 }
 


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