[gegl/abyss: 2/4] abyss policy: add repeat_mode parameter in gegl_buffer_get, gegl_sampler_get_from_buffer, gegl_sampl



commit b8ccab82ab040b4681e728c77d292182eb43e45f
Author: Michael Murà <batolettre gmail com>
Date:   Sun Sep 11 12:30:29 2011 +0200

    abyss policy: add repeat_mode parameter in gegl_buffer_get, gegl_sampler_get_from_buffer, gegl_sampler_get_from_mipmap, gegl_sampler_get_ptr. All sampler should handle the abyss policy now.

 gegl/buffer/gegl-buffer-access.c   |    2 +-
 gegl/buffer/gegl-sampler-cubic.c   |    2 +-
 gegl/buffer/gegl-sampler-linear.c  |    2 +-
 gegl/buffer/gegl-sampler-lohalo.c  |    4 ++--
 gegl/buffer/gegl-sampler-nearest.c |    2 +-
 gegl/buffer/gegl-sampler.c         |   15 +++++++++------
 gegl/buffer/gegl-sampler.h         |   23 +++++++++++++----------
 gegl/graph/gegl-node.c             |    2 +-
 operations/workshop/hstack.c       |    4 ++--
 9 files changed, 31 insertions(+), 25 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 893e267..318b4d5 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1059,7 +1059,7 @@ gegl_buffer_get (GeglBuffer          *buffer,
                  const Babl          *format,
                  gpointer             dest_buf,
                  gint                 rowstride,
-                 GeglAbyssPolicy       repeat_mode)
+                 GeglAbyssPolicy      repeat_mode)
 {
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
   gegl_buffer_get_unlocked (buffer, scale, rect, format, dest_buf, rowstride);
diff --git a/gegl/buffer/gegl-sampler-cubic.c b/gegl/buffer/gegl-sampler-cubic.c
index 24a487e..e9d827d 100644
--- a/gegl/buffer/gegl-sampler-cubic.c
+++ b/gegl/buffer/gegl-sampler-cubic.c
@@ -159,7 +159,7 @@ gegl_sampler_cubic_get (GeglSampler     *self,
   context_rect = self->context_rect[0];
   dx = (gint) x;
   dy = (gint) y;
-  sampler_bptr = gegl_sampler_get_ptr (self, dx, dy);
+  sampler_bptr = gegl_sampler_get_ptr (self, dx, dy, repeat_mode);
 
      {
        for (v=dy+context_rect.y, i=0; v < dy+context_rect.y+context_rect.height ; v++)
diff --git a/gegl/buffer/gegl-sampler-linear.c b/gegl/buffer/gegl-sampler-linear.c
index 4bc211a..9e16320 100644
--- a/gegl/buffer/gegl-sampler-linear.c
+++ b/gegl/buffer/gegl-sampler-linear.c
@@ -122,7 +122,7 @@ gegl_sampler_linear_get (GeglSampler* restrict self,
    * Point the data tile pointer to the first channel of the top_left
    * pixel value:
    */
-  const gfloat* restrict in_bptr = gegl_sampler_get_ptr (self, ix, iy);
+  const gfloat* restrict in_bptr = gegl_sampler_get_ptr (self, ix, iy, repeat_mode);
 
   /*
    * First bilinear weight:
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 97d5563..e3c2f75 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -1317,7 +1317,7 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
    * (level "0"), the one with scale=1.0.
    */
   const gfloat* restrict input_bptr =
-    (gfloat*) gegl_sampler_get_ptr (self, ix_0, iy_0);
+    (gfloat*) gegl_sampler_get_ptr (self, ix_0, iy_0, repeat_mode);
 
   /*
    * (x_0,y_0) is the relative position of the sampling location
@@ -2263,7 +2263,7 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                  * Get pointer to mipmap level 1 data:
                  */
                 const gfloat* restrict input_bptr_1 =
-                 (gfloat*) gegl_sampler_get_from_mipmap (self, ix_1, iy_1, 1);
+                 (gfloat*) gegl_sampler_get_from_mipmap (self, ix_1, iy_1, 1, repeat_mode);
 
                 /*
                  * Position of the sampling location in the coordinate
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index 86f6f72..c4fa6ed 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -69,6 +69,6 @@ gegl_sampler_nearest_get (GeglSampler    *self,
                           GeglAbyssPolicy repeat_mode)
 {
   gfloat             *sampler_bptr;
-  sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y);
+  sampler_bptr = gegl_sampler_get_from_buffer (self, (gint)x, (gint)y, repeat_mode);
   babl_process (self->fish, sampler_bptr, output, 1);
 }
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index 5596aff..21bb5a3 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -206,7 +206,8 @@ dispose (GObject *gobject)
 gfloat *
 gegl_sampler_get_ptr (GeglSampler *const sampler,
                       const gint         x,
-                      const gint         y)
+                      const gint         y,
+                      GeglAbyssPolicy    repeat_mode)
 {
   guchar *buffer_ptr;
   gint    dx;
@@ -282,7 +283,7 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
                        sampler->interpolate_format,
                        sampler->sampler_buffer[0],
                        GEGL_AUTO_ROWSTRIDE,
-                       GEGL_ABYSS_NONE);
+                       repeat_mode);
 
       sampler->sampler_rectangle[0] = fetch_rectangle;
     }
@@ -298,7 +299,8 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
 gfloat *
 gegl_sampler_get_from_buffer (GeglSampler *const sampler,
                               const gint         x,
-                              const gint         y)
+                              const gint         y,
+                              GeglAbyssPolicy    repeat_mode)
 {
   guchar *buffer_ptr;
   gint    dx;
@@ -357,7 +359,7 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
                        sampler->interpolate_format,
                        sampler->sampler_buffer[0],
                        GEGL_AUTO_ROWSTRIDE,
-                       GEGL_ABYSS_NONE);
+                       repeat_mode);
 
       sampler->sampler_rectangle[0] = fetch_rectangle;
     }
@@ -374,7 +376,8 @@ gfloat *
 gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
                               const gint         x,
                               const gint         y,
-                              const gint         level)
+                              const gint         level,
+                              GeglAbyssPolicy    repeat_mode)
 {
   guchar *buffer_ptr;
   gint    dx;
@@ -453,7 +456,7 @@ gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
                        sampler->interpolate_format,
                        sampler->sampler_buffer[level],
                        GEGL_AUTO_ROWSTRIDE,
-                       GEGL_ABYSS_NONE);
+                       repeat_mode);
 
       sampler->sampler_rectangle[level] = fetch_rectangle;
     }
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 7d68aa5..49fff3c 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -94,16 +94,19 @@ void  gegl_sampler_get         (GeglSampler   *self,
                                 void          *output,
                                 GeglAbyssPolicy repeat_mode);
 
-gfloat * gegl_sampler_get_from_buffer (GeglSampler *sampler,
-                                       gint         x,
-                                       gint         y);
-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_from_buffer (GeglSampler *const sampler,
+                                       const gint         x,
+                                       const gint         y,
+                                       GeglAbyssPolicy    repeat_mode);
+gfloat * gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
+                                       const gint         x,
+                                       const gint         y,
+                                       const gint         level,
+                                       GeglAbyssPolicy    repeat_mode);
+gfloat * gegl_sampler_get_ptr         (GeglSampler *const sampler,
+                                       const gint         x,
+                                       const gint         y,
+                                       GeglAbyssPolicy    repeat_mode);
 
 G_END_DECLS
 
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 731f0cf..b9c9bd3 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1062,7 +1062,7 @@ gegl_node_blit (GeglNode            *self,
         {
           if (destination_buf)
             {
-              gegl_buffer_get (buffer, 1.0, roi, format, destination_buf, rowstride);
+              gegl_buffer_get (buffer, 1.0, roi, format, destination_buf, rowstride, GEGL_REPEAT_MODE_ZERO);
             }
 
           if (scale != 1.0)
diff --git a/operations/workshop/hstack.c b/operations/workshop/hstack.c
index 3ba5bd5..3e41ce7 100644
--- a/operations/workshop/hstack.c
+++ b/operations/workshop/hstack.c
@@ -125,8 +125,8 @@ process (GeglOperation       *operation,
 
       gegl_buffer_get (temp_in,  NULL, 1.0, babl_format ("RGBA float"), buf,
                        GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
-      gegl_buffer_get (temp_aux, NULL, 1.0, babl_format ("RGBA float"), bufB, GEGL_AUTO_ROWSTRIDE,
-                       GEGL_ABYSS_NONE);
+      gegl_buffer_get (temp_aux, NULL, 1.0, babl_format ("RGBA float"), bufB,
+                       GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
         {
           gint offset=0;
           gint x,y;



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