[gegl/abyss: 1/4] abyss policy: add a repeat_mode parameter in gegl_buffer_sample and gegl_sampler_get. Treatment not



commit bdd82353c3bc300ea8d5eec98816e62f7b154dcc
Author: Michael Murà <batolettre gmail com>
Date:   Sun Sep 11 09:56:29 2011 +0200

    abyss policy: add a repeat_mode parameter in gegl_buffer_sample and gegl_sampler_get. Treatment not implemented yet.

 gegl/buffer/gegl-buffer-access.c      |    2 +-
 gegl/buffer/gegl-buffer.h             |    1 -
 gegl/buffer/gegl-sampler-cubic.c      |   44 +++++++++++++++++---------------
 gegl/buffer/gegl-sampler-linear.c     |    6 +++-
 gegl/buffer/gegl-sampler-lohalo.c     |    8 +++--
 gegl/buffer/gegl-sampler-nearest.c    |   22 +++++++++-------
 gegl/buffer/gegl-sampler.c            |    8 +++---
 gegl/buffer/gegl-sampler.h            |   35 +++++++++++++------------
 gegl/gegl-plugin.h                    |   15 ++++++-----
 operations/common/map-absolute.c      |    2 +-
 operations/common/map-relative.c      |    3 +-
 operations/common/ripple.c            |    3 +-
 operations/common/waves.c             |    3 +-
 operations/transform/transform-core.c |    4 +-
 operations/workshop/ditto.c           |    3 +-
 operations/workshop/whirl-pinch.c     |    2 +-
 16 files changed, 87 insertions(+), 74 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 294a70e..893e267 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1128,7 +1128,7 @@ gegl_buffer_sample (GeglBuffer       *buffer,
       gegl_sampler_prepare (buffer->sampler);
     }
 
-  gegl_sampler_get (buffer->sampler, x, y, scale, dest, GEGL_ABYSS_NONE);
+  gegl_sampler_get (buffer->sampler, x, y, scale, dest, repeat_mode);
 }
 
 void
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index c35dfa6..95d9097 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -389,7 +389,6 @@ void              gegl_buffer_sample          (GeglBuffer       *buffer,
 
 
 
-
 /**
  * gegl_buffer_sample_cleanup:
  * @buffer: the GeglBuffer to sample from
diff --git a/gegl/buffer/gegl-sampler-cubic.c b/gegl/buffer/gegl-sampler-cubic.c
index 819e4d6..24a487e 100644
--- a/gegl/buffer/gegl-sampler-cubic.c
+++ b/gegl/buffer/gegl-sampler-cubic.c
@@ -37,22 +37,23 @@ enum
 };
 
 static void      gegl_sampler_cubic_finalize (GObject      *gobject);
-static void      gegl_sampler_cubic_get (GeglSampler  *sampler,
-                                         gdouble       x,
-                                         gdouble       y,
-                                         GeglMatrix2  *scale,
-                                         void         *output);
-static void      get_property           (GObject      *gobject,
-                                         guint         prop_id,
-                                         GValue       *value,
-                                         GParamSpec   *pspec);
-static void      set_property           (GObject      *gobject,
-                                         guint         prop_id,
-                                         const GValue *value,
-                                         GParamSpec   *pspec);
-static inline gfloat cubicKernel       (gfloat        x,
-                                        gfloat        b,
-                                        gfloat        c);
+static void      gegl_sampler_cubic_get (GeglSampler     *sampler,
+                                         gdouble          x,
+                                         gdouble          y,
+                                         GeglMatrix2     *scale,
+                                         void            *output,
+                                         GeglAbyssPolicy  repeat_mode);
+static void      get_property           (GObject         *gobject,
+                                         guint            prop_id,
+                                         GValue          *value,
+                                         GParamSpec      *pspec);
+static void      set_property           (GObject         *gobject,
+                                         guint            prop_id,
+                                         const GValue    *value,
+                                         GParamSpec      *pspec);
+static inline gfloat cubicKernel        (gfloat           x,
+                                         gfloat           b,
+                                         gfloat           c);
 
 
 G_DEFINE_TYPE (GeglSamplerCubic, gegl_sampler_cubic, GEGL_TYPE_SAMPLER)
@@ -133,11 +134,12 @@ gegl_sampler_cubic_init (GeglSamplerCubic *self)
 }
 
 void
-gegl_sampler_cubic_get (GeglSampler *self,
-                        gdouble      x,
-                        gdouble      y,
-                        GeglMatrix2 *scale,
-                        void        *output)
+gegl_sampler_cubic_get (GeglSampler     *self,
+                        gdouble          x,
+                        gdouble          y,
+                        GeglMatrix2     *scale,
+                        void            *output,
+                        GeglAbyssPolicy  repeat_mode)
 {
   GeglSamplerCubic *cubic = (GeglSamplerCubic*)(self);
   GeglRectangle     context_rect;
diff --git a/gegl/buffer/gegl-sampler-linear.c b/gegl/buffer/gegl-sampler-linear.c
index b3477a5..4bc211a 100644
--- a/gegl/buffer/gegl-sampler-linear.c
+++ b/gegl/buffer/gegl-sampler-linear.c
@@ -66,7 +66,8 @@ static void gegl_sampler_linear_get (GeglSampler* restrict self,
                                      const gdouble         x,
                                      const gdouble         y,
                                      GeglMatrix2          *scale,
-                                     void*        restrict output);
+                                     void*        restrict output,
+                                     GeglAbyssPolicy       repeat_mode);
 
 G_DEFINE_TYPE (GeglSamplerLinear, gegl_sampler_linear, GEGL_TYPE_SAMPLER)
 
@@ -93,7 +94,8 @@ gegl_sampler_linear_get (GeglSampler* restrict self,
                          const gdouble         absolute_x,
                          const gdouble         absolute_y,
                          GeglMatrix2          *scale,
-                         void*        restrict output)
+                         void*        restrict output,
+                         GeglAbyssPolicy       repeat_mode)
 {
   const gint pixels_per_buffer_row = 64;
   const gint channels = 4;
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 312bf97..97d5563 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -258,7 +258,8 @@ static void gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                                      const gdouble               absolute_x,
                                      const gdouble               absolute_y,
                                            GeglMatrix2          *scale,
-                                           void*        restrict output);
+                                           void*        restrict output,
+                                           GeglAbyssPolicy       repeat_mode);
 
 G_DEFINE_TYPE (GeglSamplerLohalo, gegl_sampler_lohalo, GEGL_TYPE_SAMPLER)
 
@@ -1290,8 +1291,9 @@ static void
 gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                          const gdouble               absolute_x,
                          const gdouble               absolute_y,
-                         GeglMatrix2                *scale,
-                               void*        restrict output)
+                               GeglMatrix2          *scale,
+                               void*        restrict output,
+                               GeglAbyssPolicy       repeat_mode)
 {
   /*
    * Needed constants related to the input pixel value pointer
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index 7def771..86f6f72 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -32,11 +32,12 @@ enum
   PROP_LAST
 };
 
-static void    gegl_sampler_nearest_get (GeglSampler  *self,
-                                         gdouble       x,
-                                         gdouble       y,
-                                         GeglMatrix2  *scale,
-                                         void         *output);
+static void    gegl_sampler_nearest_get (GeglSampler    *self,
+                                         gdouble         x,
+                                         gdouble         y,
+                                         GeglMatrix2    *scale,
+                                         void           *output,
+                                         GeglAbyssPolicy repeat_mode);
 
 G_DEFINE_TYPE (GeglSamplerNearest, gegl_sampler_nearest, GEGL_TYPE_SAMPLER)
 
@@ -60,11 +61,12 @@ gegl_sampler_nearest_init (GeglSamplerNearest *self)
 }
 
 void
-gegl_sampler_nearest_get (GeglSampler *self,
-                          gdouble      x,
-                          gdouble      y,
-                          GeglMatrix2 *scale,
-                          void        *output)
+gegl_sampler_nearest_get (GeglSampler    *self,
+                          gdouble         x,
+                          gdouble         y,
+                          GeglMatrix2    *scale,
+                          void           *output,
+                          GeglAbyssPolicy repeat_mode)
 {
   gfloat             *sampler_bptr;
   sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index 2146f01..5596aff 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -57,10 +57,10 @@ static void get_property (GObject    *gobject,
                           GValue     *value,
                           GParamSpec *pspec);
 
-static void set_property (      GObject      *gobject,
-                                guint         property_id,
+static void set_property (GObject      *gobject,
+                          guint         property_id,
                           const GValue *value,
-                                GParamSpec   *pspec);
+                          GParamSpec   *pspec);
 
 static void set_buffer (GeglSampler  *self,
                         GeglBuffer   *buffer);
@@ -122,7 +122,7 @@ gegl_sampler_get (GeglSampler   *self,
                   void          *output,
                   GeglAbyssPolicy repeat_mode)
 {
-  self->get (self, x, y, scale, output);
+  self->get (self, x, y, scale, output, repeat_mode);
 }
 
 void
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 3cd8bab..7d68aa5 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -38,11 +38,12 @@ typedef struct _GeglSamplerClass GeglSamplerClass;
 struct _GeglSampler
 {
   GObject       parent_instance;
-  void (* get) (GeglSampler *self,
-                gdouble      x,
-                gdouble      y,
-                GeglMatrix2 *scale,
-                void        *output);
+  void (* get) (GeglSampler     *self,
+                gdouble          x,
+                gdouble          y,
+                GeglMatrix2     *scale,
+                void            *output,
+                GeglAbyssPolicy  repeat_mode);
   /* we cache the getter in the instance, (being able to return the
      function pointer itself and cache it outside the calling loop
      would be even quicker.
@@ -66,14 +67,15 @@ struct _GeglSamplerClass
 {
   GObjectClass  parent_class;
 
-  void (* prepare)   (GeglSampler *self);
-  void (* get)       (GeglSampler *self,
-                      gdouble      x,
-                      gdouble      y,
-                      GeglMatrix2 *scale,
-                      void        *output);
- void  (*set_buffer) (GeglSampler  *self,
-                      GeglBuffer   *buffer);
+  void (* prepare)   (GeglSampler     *self);
+  void (* get)       (GeglSampler     *self,
+                      gdouble          x,
+                      gdouble          y,
+                      GeglMatrix2     *scale,
+                      void            *output,
+                      GeglAbyssPolicy  repeat_mode);
+ void  (*set_buffer) (GeglSampler     *self,
+                      GeglBuffer      *buffer);
 
  gpointer       padding[8]; /* eat from the padding if adding to the struct */
 };
@@ -99,10 +101,9 @@ gfloat * gegl_sampler_get_from_mipmap (GeglSampler *sampler,
                                        gint         x,
                                        gint         y,
                                        gint         level);
-gfloat *
-gegl_sampler_get_ptr (GeglSampler         *sampler,
-                      gint                 x,
-                      gint                 y);
+gfloat * gegl_sampler_get_ptr         (GeglSampler *sampler,
+                                       gint         x,
+                                       gint         y);
 
 G_END_DECLS
 
diff --git a/gegl/gegl-plugin.h b/gegl/gegl-plugin.h
index c545e73..2eb5282 100644
--- a/gegl/gegl-plugin.h
+++ b/gegl/gegl-plugin.h
@@ -127,16 +127,17 @@ const gchar   * gegl_extension_handler_get_saver   (const gchar         *extensi
 typedef struct
 {
   GObject       parent_instance;
-  void (* get) (GeglSampler *self,
-                gdouble      x,
-                gdouble      y,
-                GeglMatrix2 *scale,
-                void        *output);
+  void (* get) (GeglSampler    *self,
+                gdouble         x,
+                gdouble         y,
+                GeglMatrix2    *scale,
+                void           *output,
+                GeglAbyssPolicy repeat_mode);
 } SamplerMock;
 
 
-#define gegl_sampler_get(sampler,x,y,scale,dest) \
-  ((SamplerMock*)(sampler))->get((sampler),(x),(y),(scale),(dest))
+#define gegl_sampler_get(sampler,x,y,scale,dest,repeat) \
+  ((SamplerMock*)(sampler))->get((sampler),(x),(y),(scale),(dest),(repeat))
 
 #include <glib-object.h>
 #include <babl/babl.h>
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index d3315cf..d3866d6 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -101,7 +101,7 @@ process (GeglOperation       *operation,
                 }
               else
                 {
-                  gegl_sampler_get (sampler, coords[0], coords[1], NULL, out);
+                  gegl_sampler_get (sampler, coords[0], coords[1], NULL, out, GEGL_ABYSS_NONE);
                 }
 
               coords += 2;
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index 649bc94..72b6cf0 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -109,7 +109,8 @@ process (GeglOperation       *operation,
                 {
                   gegl_sampler_get (sampler, x+coords[0] * scaling,
                                              y+coords[1] * scaling,
-                                             NULL, out);
+                                             NULL, out,
+                                             GEGL_ABYSS_NONE);
                 }
 
               coords += 2;
diff --git a/operations/common/ripple.c b/operations/common/ripple.c
index 392242c..944a9bd 100644
--- a/operations/common/ripple.c
+++ b/operations/common/ripple.c
@@ -129,7 +129,8 @@ process (GeglOperation       *operation,
                         coordsx,
                         coordsy,
                         NULL,
-                        out_pixel);
+                        out_pixel,
+                        GEGL_ABYSS_NONE);
 
       out_pixel += 4;
 
diff --git a/operations/common/waves.c b/operations/common/waves.c
index e65c894..8f8424f 100644
--- a/operations/common/waves.c
+++ b/operations/common/waves.c
@@ -124,7 +124,8 @@ process (GeglOperation       *operation,
                         coordsx,
                         coordsy,
                         NULL,
-                        out_pixel);
+                        out_pixel,
+                        GEGL_ABYSS_NONE);
 
       out_pixel += 4;
 
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 385caee..64054ca 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -710,7 +710,7 @@ transform_affine (GeglBuffer  *dest,
 
           for (x = roi->width; x--;)
             {
-              gegl_sampler_get (sampler, u_float/w_float, v_float/w_float, &inverse_jacobian, dest_ptr);
+              gegl_sampler_get (sampler, u_float/w_float, v_float/w_float, &inverse_jacobian, dest_ptr, GEGL_ABYSS_NONE);
               dest_ptr+=4;
               u_float += inverse.coeff [0][0];
               v_float += inverse.coeff [1][0];
@@ -794,7 +794,7 @@ transform_generic (GeglBuffer  *dest,
               inverse_jacobian.coeff[1][0] = (inverse.coeff[1][0] - inverse.coeff[2][0] * v) * w_recip;
               inverse_jacobian.coeff[1][1] = (inverse.coeff[1][1] - inverse.coeff[2][1] * v) * w_recip;
 
-              gegl_sampler_get (sampler, u, v, &inverse_jacobian, dest_ptr);
+              gegl_sampler_get (sampler, u, v, &inverse_jacobian, dest_ptr, GEGL_ABYSS_NONE);
               dest_ptr+=4;
 
               u_float += inverse.coeff [0][0];
diff --git a/operations/workshop/ditto.c b/operations/workshop/ditto.c
index 0019b29..a6a294d 100644
--- a/operations/workshop/ditto.c
+++ b/operations/workshop/ditto.c
@@ -71,7 +71,8 @@ process (GeglOperation       *operation,
                         x,
                         y,
                         NULL,
-                        out_pixel);
+                        out_pixel,
+                        GEGL_ABYSS_NONE);
 
       out_pixel += 4;
 
diff --git a/operations/workshop/whirl-pinch.c b/operations/workshop/whirl-pinch.c
index 0a901eb..eb71dff 100644
--- a/operations/workshop/whirl-pinch.c
+++ b/operations/workshop/whirl-pinch.c
@@ -158,7 +158,7 @@ apply_whirl_pinch (gdouble whirl, gdouble pinch, gdouble radius,
         gegl_sampler_compute_scale (scale, roi->x + col, roi->y + row);
         gegl_unmap (roi->x + col, roi->y + row, cx, cy);
 
-        gegl_sampler_get (sampler, cx, cy, &scale, &dst_buf[(row * roi->width + col) * 4]);
+        gegl_sampler_get (sampler, cx, cy, &scale, &dst_buf[(row * roi->width + col) * 4], GEGL_ABYSS_NONE);
     } /* for */
   } /* for */
 



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