[gimp] plug-ins: in smooth-palette, use sampler object ...



commit 2d421d7f071c7bfa45abd072a71505b4b40ea6c5
Author: Ell <ell_se yahoo com>
Date:   Sun May 13 19:39:16 2018 -0400

    plug-ins: in smooth-palette, use sampler object ...
    
    ... instead of gegl_buffer_sample()
    
    Ditto.

 plug-ins/common/smooth-palette.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/common/smooth-palette.c b/plug-ins/common/smooth-palette.c
index 6a42904..35add06 100644
--- a/plug-ins/common/smooth-palette.c
+++ b/plug-ins/common/smooth-palette.c
@@ -243,6 +243,7 @@ smooth_palette (gint32  drawable_id,
   gint          sel_x1, sel_y1;
   gint          width, height;
   GeglBuffer   *buffer;
+  GeglSampler  *sampler;
   gfloat       *pal;
   GRand        *gr;
 
@@ -273,6 +274,8 @@ smooth_palette (gint32  drawable_id,
 
   buffer = gimp_drawable_get_buffer (drawable_id);
 
+  sampler = gegl_buffer_sampler_new (buffer, format, GEGL_SAMPLER_NEAREST);
+
   bpp = babl_format_get_n_components (gegl_buffer_get_format (buffer));
 
   pal = g_new (gfloat, psize * bpp);
@@ -284,11 +287,12 @@ smooth_palette (gint32  drawable_id,
       gint x = sel_x1 + g_rand_int_range (gr, 0, width);
       gint y = sel_y1 + g_rand_int_range (gr, 0, height);
 
-      gegl_buffer_sample (buffer, (gdouble) x, (gdouble) y, NULL, pal + i * bpp,
-                          format, GEGL_SAMPLER_NEAREST,
-                          GEGL_ABYSS_NONE);
+      gegl_sampler_get (sampler,
+                        (gdouble) x, (gdouble) y, NULL, pal + i * bpp,
+                        GEGL_ABYSS_NONE);
     }
 
+  g_object_unref (sampler);
   g_object_unref (buffer);
 
   /* reorder */


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