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



commit 2079d2e8f1bf98f54b87b1ba4dc31311c058d821
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Oct 12 02:51:01 2017 +0200

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

 operations/common/noise-pick.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/operations/common/noise-pick.c b/operations/common/noise-pick.c
index 3602232..9869fae 100644
--- a/operations/common/noise-pick.c
+++ b/operations/common/noise-pick.c
@@ -80,6 +80,7 @@ process (GeglOperation       *operation,
   const Babl         *format;
   gint                bpp;
   GeglBufferIterator *gi;
+  GeglSampler        *sampler;
 
   o = GEGL_PROPERTIES (operation);
 
@@ -89,6 +90,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];
@@ -115,12 +118,11 @@ 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]