[gegl] Starting to add mipmap access to samplers. Some lohalo fixes.



commit 53c7c9698f79fb4063305c6d2c10f3ed33e50547
Author: Adam Turcotte <aturcotte src gnome org>
Date:   Mon Jun 27 15:45:47 2011 -0400

    Starting to add mipmap access to samplers. Some lohalo fixes.

 gegl/buffer/gegl-sampler-cubic.c   |   10 +-
 gegl/buffer/gegl-sampler-lanczos.c |   10 +-
 gegl/buffer/gegl-sampler-linear.c  |    8 +-
 gegl/buffer/gegl-sampler-lohalo.c  |   22 +++---
 gegl/buffer/gegl-sampler-nearest.c |    8 +-
 gegl/buffer/gegl-sampler.c         |  176 ++++++++++++++++++++++++++++--------
 gegl/buffer/gegl-sampler.h         |   11 ++-
 operations/affine/affine.c         |   14 ++--
 8 files changed, 180 insertions(+), 79 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-cubic.c b/gegl/buffer/gegl-sampler-cubic.c
index 599aaed..be5f1ae 100644
--- a/gegl/buffer/gegl-sampler-cubic.c
+++ b/gegl/buffer/gegl-sampler-cubic.c
@@ -96,10 +96,10 @@ gegl_sampler_cubic_class_init (GeglSamplerCubicClass *klass)
 static void
 gegl_sampler_cubic_init (GeglSamplerCubic *self)
 {
- GEGL_SAMPLER (self)->context_rect.x = -1;
- GEGL_SAMPLER (self)->context_rect.y = -1;
- GEGL_SAMPLER (self)->context_rect.width = 4;
- GEGL_SAMPLER (self)->context_rect.height = 4;
+ GEGL_SAMPLER (self)->context_rect[0].x = -1;
+ GEGL_SAMPLER (self)->context_rect[0].y = -1;
+ GEGL_SAMPLER (self)->context_rect[0].width = 4;
+ GEGL_SAMPLER (self)->context_rect[0].height = 4;
  GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
  self->b=1.0;
  self->c=0.0;
@@ -148,7 +148,7 @@ gegl_sampler_cubic_get (GeglSampler *self,
   gint              dx,dy;
   gint              i;
 
-  context_rect = self->context_rect;
+  context_rect = self->context_rect[0];
   dx = (gint) x;
   dy = (gint) y;
   sampler_bptr = gegl_sampler_get_ptr (self, dx, dy);
diff --git a/gegl/buffer/gegl-sampler-lanczos.c b/gegl/buffer/gegl-sampler-lanczos.c
index afd4050..9d10299 100644
--- a/gegl/buffer/gegl-sampler-lanczos.c
+++ b/gegl/buffer/gegl-sampler-lanczos.c
@@ -148,7 +148,7 @@ gegl_sampler_lanczos_get (GeglSampler *self,
                           void        *output)
 {
   GeglSamplerLanczos      *lanczos      = GEGL_SAMPLER_LANCZOS (self);
-  GeglRectangle            context_rect = self->context_rect;
+  GeglRectangle            context_rect = self->context_rect[0];
   gfloat                  *sampler_bptr;
   gdouble                  x_sum, y_sum;
   gfloat                   newval[4] = {0.0, 0.0, 0.0, 0.0};
@@ -238,10 +238,10 @@ set_property (GObject      *object,
       case PROP_LANCZOS_WIDTH:
         {
         self->lanczos_width = g_value_get_int (value);
-        GEGL_SAMPLER (self)->context_rect.x = - self->lanczos_width;
-        GEGL_SAMPLER (self)->context_rect.y = - self->lanczos_width;
-        GEGL_SAMPLER (self)->context_rect.width = self->lanczos_width*2+1;
-        GEGL_SAMPLER (self)->context_rect.height = self->lanczos_width*2+1;
+        GEGL_SAMPLER (self)->context_rect[0].x = - self->lanczos_width;
+        GEGL_SAMPLER (self)->context_rect[0].y = - self->lanczos_width;
+        GEGL_SAMPLER (self)->context_rect[0].width = self->lanczos_width*2+1;
+        GEGL_SAMPLER (self)->context_rect[0].height = self->lanczos_width*2+1;
         }
         break;
 
diff --git a/gegl/buffer/gegl-sampler-linear.c b/gegl/buffer/gegl-sampler-linear.c
index c5dfd1c..d1980dc 100644
--- a/gegl/buffer/gegl-sampler-linear.c
+++ b/gegl/buffer/gegl-sampler-linear.c
@@ -94,10 +94,10 @@ gegl_sampler_linear_class_init (GeglSamplerLinearClass *klass)
 static void
 gegl_sampler_linear_init (GeglSamplerLinear *self)
 {
-  GEGL_SAMPLER (self)->context_rect.x = 0;
-  GEGL_SAMPLER (self)->context_rect.y = 0;
-  GEGL_SAMPLER (self)->context_rect.width = 2;
-  GEGL_SAMPLER (self)->context_rect.height = 2;
+  GEGL_SAMPLER (self)->context_rect[0].x = 0;
+  GEGL_SAMPLER (self)->context_rect[0].y = 0;
+  GEGL_SAMPLER (self)->context_rect[0].width = 2;
+  GEGL_SAMPLER (self)->context_rect[0].height = 2;
   GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
 }
 
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 066d031..ac34588 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -311,10 +311,10 @@ gegl_sampler_lohalo_class_init (GeglSamplerLohaloClass *klass)
 static void
 gegl_sampler_lohalo_init (GeglSamplerLohalo *self)
 {
-  GEGL_SAMPLER (self)->context_rect.x = -LOHALO_OFFSET;
-  GEGL_SAMPLER (self)->context_rect.y = -LOHALO_OFFSET;
-  GEGL_SAMPLER (self)->context_rect.width  = LOHALO_SIZE;
-  GEGL_SAMPLER (self)->context_rect.height = LOHALO_SIZE;
+  GEGL_SAMPLER (self)->context_rect[0].x = -LOHALO_OFFSET;
+  GEGL_SAMPLER (self)->context_rect[0].y = -LOHALO_OFFSET;
+  GEGL_SAMPLER (self)->context_rect[0].width  = LOHALO_SIZE;
+  GEGL_SAMPLER (self)->context_rect[0].height = LOHALO_SIZE;
   GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float");
 }
 
@@ -2079,10 +2079,10 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
           {
             gint i = -LOHALO_OFFSET;
             do
-              (
+              {
                 gint j = -LOHALO_OFFSET;
                 do
-                  (
+                  {
                     ewa_update ((j),                            
                                 (i),                            
                                 c_major_x,     
@@ -2096,8 +2096,8 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                                 input_bptr,    
                                 &total_weight, 
                                 ewa_newval);
-                  ) while ( ++j <= LOHALO_OFFSET );
-              ) while ( ++i <= LOHALO_OFFSET );
+                  } while ( ++j <= LOHALO_OFFSET );
+              } while ( ++i <= LOHALO_OFFSET );
           }
 
           {
@@ -2225,11 +2225,10 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                 const gint iy_1 = LOHALO_FLOORED_DIVISION_BY_2(iy_0);
                 
                 /*
-                 * ADAM: THE POINTER get NEEDS TO BE HERE.
+                 * Get pointer to mipmap level 1 data:
                  */
-                /* FIXME: need to call ewa_get_ptr () instead */
                 const gfloat* restrict input_bptr_1 =
-                 (gfloat*) gegl_sampler_get_ptr (self, ix_0, iy_0);
+                 (gfloat*) gegl_sampler_get_from_mipmap (self, ix_0, iy_0, 1);
 
                 /*
                  * Position of the sampling location in the coordinate
@@ -2345,6 +2344,7 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
                     } while ( ++i < in_bot );
                 }
                 {
+                  gint i;
                   for ( i = in_bot; i <= out_bot; i++ )
                     {
                       gint j = out_left;
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index 5401765..6f3d361 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -63,10 +63,10 @@ gegl_sampler_nearest_class_init (GeglSamplerNearestClass *klass)
 static void
 gegl_sampler_nearest_init (GeglSamplerNearest *self)
 {
-   GEGL_SAMPLER (self)->context_rect.x = 0;
-   GEGL_SAMPLER (self)->context_rect.y = 0;
-   GEGL_SAMPLER (self)->context_rect.width = 1;
-   GEGL_SAMPLER (self)->context_rect.height = 1;
+   GEGL_SAMPLER (self)->context_rect[0].x = 0;
+   GEGL_SAMPLER (self)->context_rect[0].y = 0;
+   GEGL_SAMPLER (self)->context_rect[0].width = 1;
+   GEGL_SAMPLER (self)->context_rect[0].height = 1;
    GEGL_SAMPLER (self)->interpolate_format = babl_format ("RGBA float");
 }
 
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index 3875fcb..d540477 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -20,6 +20,7 @@
 
 #include <glib-object.h>
 #include <string.h>
+#include <math.h>
 
 #include "gegl.h"
 #include "gegl-types-internal.h"
@@ -110,12 +111,15 @@ gegl_sampler_class_init (GeglSamplerClass *klass)
 static void
 gegl_sampler_init (GeglSampler *self)
 {
-  GeglRectangle context_rect = {0,0,1,1};
-  GeglRectangle sampler_rectangle = {0,0,0,0};
-  self->sampler_buffer = NULL;
+  int i;
   self->buffer = NULL;
-  self->context_rect = context_rect;
-  self->sampler_rectangle = sampler_rectangle;
+  for (i=0; i<3; ++i) {
+    GeglRectangle context_rect = {0,0,1,1};
+    GeglRectangle sampler_rectangle = {0,0,0,0};
+    self->sampler_buffer[i] = NULL;
+    self->context_rect[i] = context_rect;
+    self->sampler_rectangle[i] = sampler_rectangle;
+  }
 }
 
 void
@@ -157,8 +161,8 @@ gegl_sampler_prepare (GeglSampler *self)
    * This makes the cache rect invalid, in case the data in the buffer
    * has changed:
    */
-  self->sampler_rectangle.width = 0;
-  self->sampler_rectangle.height = 0;
+  self->sampler_rectangle[0].width = 0;
+  self->sampler_rectangle[0].height = 0;
 
 #if 0
   if (self->cache_buffer) /* Force a regetting of the region, even
@@ -191,7 +195,7 @@ finalize (GObject *gobject)
   if (sampler->sampler_buffer)
     {
       g_free (sampler->sampler_buffer);
-      sampler->sampler_buffer = NULL;
+      sampler->sampler_buffer[0] = NULL;
     }
   G_OBJECT_CLASS (gegl_sampler_parent_class)->finalize (gobject);
 }
@@ -231,24 +235,24 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
    * in GEGL).
    */
   const gint maximum_width_and_height = 64;
-  g_assert (sampler->context_rect.width  <= maximum_width_and_height);
-  g_assert (sampler->context_rect.height <= maximum_width_and_height);
+  g_assert (sampler->context_rect[0].width  <= maximum_width_and_height);
+  g_assert (sampler->context_rect[0].height <= maximum_width_and_height);
 
   if (( sampler->sampler_buffer == NULL )
       ||
-      ( x + sampler->context_rect.x < sampler->sampler_rectangle.x )
+      ( x + sampler->context_rect[0].x < sampler->sampler_rectangle[0].x )
       ||
-      ( y + sampler->context_rect.y < sampler->sampler_rectangle.y )
+      ( y + sampler->context_rect[0].y < sampler->sampler_rectangle[0].y )
       ||
-      ( x + sampler->context_rect.x + sampler->context_rect.width
-        >= sampler->sampler_rectangle.x + sampler->sampler_rectangle.width )
+      ( x + sampler->context_rect[0].x + sampler->context_rect[0].width
+        >= sampler->sampler_rectangle[0].x + sampler->sampler_rectangle[0].width )
       ||
-      ( y + sampler->context_rect.y + sampler->context_rect.height
-        >= sampler->sampler_rectangle.y + sampler->sampler_rectangle.height ))
+      ( y + sampler->context_rect[0].y + sampler->context_rect[0].height
+        >= sampler->sampler_rectangle[0].y + sampler->sampler_rectangle[0].height ))
     {
       /*
        * fetch_rectangle will become the value of
-       * sampler->sampler_rectangle:
+       * sampler->sampler_rectangle[0]:
        */
       GeglRectangle fetch_rectangle;
 
@@ -266,11 +270,11 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
        * much if at all, as should be.
        */
       fetch_rectangle.x =
-        x + sampler->context_rect.x
-        - ( maximum_width_and_height - sampler->context_rect.width  ) / 8;
+        x + sampler->context_rect[0].x
+        - ( maximum_width_and_height - sampler->context_rect[0].width  ) / 8;
       fetch_rectangle.y =
-        y + sampler->context_rect.y
-        - ( maximum_width_and_height - sampler->context_rect.height ) / 8;
+        y + sampler->context_rect[0].y
+        - ( maximum_width_and_height - sampler->context_rect[0].height ) / 8;
 
       fetch_rectangle.width  = maximum_width_and_height;
       fetch_rectangle.height = maximum_width_and_height;
@@ -280,7 +284,7 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
           /*
            * Always request the same amount of pixels:
            */
-          sampler->sampler_buffer =
+          sampler->sampler_buffer[0] =
             g_malloc0 (( maximum_width_and_height * maximum_width_and_height )
                        * bpp);
         }
@@ -292,13 +296,13 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
                        sampler->sampler_buffer,
                        GEGL_AUTO_ROWSTRIDE);
 
-      sampler->sampler_rectangle = fetch_rectangle;
+      sampler->sampler_rectangle[0] = fetch_rectangle;
     }
 
-  dx = x - sampler->sampler_rectangle.x;
-  dy = y - sampler->sampler_rectangle.y;
+  dx = x - sampler->sampler_rectangle[0].x;
+  dy = y - sampler->sampler_rectangle[0].y;
   buffer_ptr = (guchar *)sampler->sampler_buffer;
-  sof = ( dx + dy * sampler->sampler_rectangle.width ) * bpp;
+  sof = ( dx + dy * sampler->sampler_rectangle[0].width ) * bpp;
 
   return (gfloat*)(buffer_ptr+sof);
 }
@@ -322,18 +326,18 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
    * in GEGL).
    */
   const gint maximum_width_and_height = 64;
-  g_assert (sampler->context_rect.width  <= maximum_width_and_height);
-  g_assert (sampler->context_rect.height <= maximum_width_and_height);
+  g_assert (sampler->context_rect[0].width  <= maximum_width_and_height);
+  g_assert (sampler->context_rect[0].height <= maximum_width_and_height);
 
   if (( sampler->sampler_buffer == NULL )
       ||
-      ( x < sampler->sampler_rectangle.x )
+      ( x < sampler->sampler_rectangle[0].x )
       ||
-      ( y < sampler->sampler_rectangle.y )
+      ( y < sampler->sampler_rectangle[0].y )
       ||
-      ( x >= sampler->sampler_rectangle.x + sampler->sampler_rectangle.width )
+      ( x >= sampler->sampler_rectangle[0].x + sampler->sampler_rectangle[0].width )
       ||
-      ( y >= sampler->sampler_rectangle.y + sampler->sampler_rectangle.height ))
+      ( y >= sampler->sampler_rectangle[0].y + sampler->sampler_rectangle[0].height ))
     {
       /*
        * fetch_rectangle will become the value of
@@ -342,9 +346,9 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
       GeglRectangle fetch_rectangle;
 
       fetch_rectangle.x =
-        x - ( maximum_width_and_height - sampler->context_rect.width  ) / 8;
+        x - ( maximum_width_and_height - sampler->context_rect[0].width  ) / 8;
       fetch_rectangle.y =
-        y - ( maximum_width_and_height - sampler->context_rect.height ) / 8;
+        y - ( maximum_width_and_height - sampler->context_rect[0].height ) / 8;
 
       fetch_rectangle.width  = maximum_width_and_height;
       fetch_rectangle.height = maximum_width_and_height;
@@ -354,7 +358,7 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
           /*
            * Always request the same amount of pixels:
            */
-          sampler->sampler_buffer =
+          sampler->sampler_buffer[0] =
             g_malloc0 (( maximum_width_and_height * maximum_width_and_height )
                        * bpp);
         }
@@ -366,13 +370,107 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
                        sampler->sampler_buffer,
                        GEGL_AUTO_ROWSTRIDE);
 
-      sampler->sampler_rectangle = fetch_rectangle;
+      sampler->sampler_rectangle[0] = fetch_rectangle;
+    }
+
+  dx = x - sampler->sampler_rectangle[0].x;
+  dy = y - sampler->sampler_rectangle[0].y;
+  buffer_ptr = (guchar *)sampler->sampler_buffer;
+  sof = ( dx + dy * sampler->sampler_rectangle[0].width ) * bpp;
+
+  return (gfloat*)(buffer_ptr+sof);
+}
+
+gfloat *
+gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
+                              const gint         x,
+                              const gint         y,
+                              const gint         level)
+{
+  guchar *buffer_ptr;
+  gint    dx;
+  gint    dy;
+  gint    sof;
+
+  const gdouble scale = 1. / (pow(2., (gdouble)level));
+
+  const gint bpp =
+    babl_format_get_bytes_per_pixel (sampler->interpolate_format);
+
+  /*
+   * maximum_width_and_height is the largest number of pixels which
+   * can be be requested in the horizontal or vertical directions (64
+   * in GEGL).
+   */
+  const gint maximum_width_and_height = 64;
+  g_assert (sampler->context_rect[level].width  <= maximum_width_and_height);
+  g_assert (sampler->context_rect[level].height <= maximum_width_and_height);
+
+  if (( sampler->sampler_buffer == NULL )
+      ||
+      ( x + sampler->context_rect[level].x < sampler->sampler_rectangle[level].x )
+      ||
+      ( y + sampler->context_rect[level].y < sampler->sampler_rectangle[level].y )
+      ||
+      ( x + sampler->context_rect[level].x + sampler->context_rect[level].width
+        >= sampler->sampler_rectangle[level].x + sampler->sampler_rectangle[level].width )
+      ||
+      ( y + sampler->context_rect[level].y + sampler->context_rect[level].height
+        >= sampler->sampler_rectangle[level].y + sampler->sampler_rectangle[level].height ))
+    {
+      /*
+       * fetch_rectangle will become the value of
+       * sampler->sampler_rectangle[level]:
+       */
+      GeglRectangle fetch_rectangle;
+
+      /*
+       * Override the fetch rectangle needed by the sampler, hoping
+       * that the extra pixels are useful for subsequent requests,
+       * assuming that it is more likely that further access is to the
+       * right or down of our currently requested
+       * position. Consequently, we move the top left corner of the
+       * context_rect by about one fourth of the maximal distance we
+       * can (one fourth of one half = one eight). Given that the
+       * maximum width and height of the fetch_rectangle is 64, so
+       * that half of it is 32, one fourth of the elbow room is at
+       * most 8. If context_rect is large, the corner is not moved
+       * much if at all, as should be.
+       */
+      fetch_rectangle.x =
+        x + sampler->context_rect[level].x
+        - ( maximum_width_and_height - sampler->context_rect[level].width  ) / 8;
+      fetch_rectangle.y =
+        y + sampler->context_rect[level].y
+        - ( maximum_width_and_height - sampler->context_rect[level].height ) / 8;
+
+      fetch_rectangle.width  = maximum_width_and_height;
+      fetch_rectangle.height = maximum_width_and_height;
+
+      if (sampler->sampler_buffer == NULL)
+        {
+          /*
+           * Always request the same amount of pixels:
+           */
+          sampler->sampler_buffer[level] =
+            g_malloc0 (( maximum_width_and_height * maximum_width_and_height )
+                       * bpp);
+        }
+
+      gegl_buffer_get (sampler->buffer,
+                       scale,
+                       &fetch_rectangle,
+                       sampler->interpolate_format,
+                       sampler->sampler_buffer[level],
+                       GEGL_AUTO_ROWSTRIDE);
+
+      sampler->sampler_rectangle[level] = fetch_rectangle;
     }
 
-  dx = x - sampler->sampler_rectangle.x;
-  dy = y - sampler->sampler_rectangle.y;
+  dx = x - sampler->sampler_rectangle[level].x;
+  dy = y - sampler->sampler_rectangle[level].y;
   buffer_ptr = (guchar *)sampler->sampler_buffer;
-  sof = ( dx + dy * sampler->sampler_rectangle.width ) * bpp;
+  sof = ( dx + dy * sampler->sampler_rectangle[level].width ) * bpp;
 
   return (gfloat*)(buffer_ptr+sof);
 }
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 9600c7e..8f90727 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -44,9 +44,9 @@ struct _GeglSampler
   Babl          *format;
   Babl          *interpolate_format;
   Babl          *fish;
-  GeglRectangle  context_rect;
-  void          *sampler_buffer;
-  GeglRectangle  sampler_rectangle;
+  GeglRectangle  context_rect[3];
+  gpointer       sampler_buffer[3];
+  GeglRectangle  sampler_rectangle[3];
   GeglMatrix2   *inverse_jacobian;
   gdouble        x; /* mirrors the currently requested */
   gdouble        y; /* coordinates in the instance     */
@@ -79,7 +79,10 @@ void  gegl_sampler_get         (GeglSampler *self,
 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,
diff --git a/operations/affine/affine.c b/operations/affine/affine.c
index a94a4a2..71f68d5 100644
--- a/operations/affine/affine.c
+++ b/operations/affine/affine.c
@@ -484,7 +484,7 @@ gegl_affine_get_bounding_box (GeglOperation *op)
   GeglSampler   *sampler;
 
   sampler = op_affine_sampler (OP_AFFINE (op));
-  context_rect = sampler->context_rect;
+  context_rect = sampler->context_rect[0];
   g_object_unref (sampler);
 
   if (gegl_operation_source_get_bounding_box (op, "input"))
@@ -570,7 +570,7 @@ gegl_affine_get_required_for_output (GeglOperation       *op,
 
   requested_rect = *region;
   sampler = op_affine_sampler (OP_AFFINE (op));
-  context_rect = sampler->context_rect;
+  context_rect = sampler->context_rect[0];
   g_object_unref (sampler);
 
   gegl_affine_create_composite_matrix (affine, &inverse);
@@ -621,7 +621,7 @@ gegl_affine_get_invalidated_by_change (GeglOperation       *op,
   GeglRectangle      region = *input_region;
 
   sampler = op_affine_sampler (OP_AFFINE (op));
-  context_rect = sampler->context_rect;
+  context_rect = sampler->context_rect[0];
   g_object_unref (sampler);
 
   gegl_affine_create_matrix (affine, &matrix);
@@ -931,8 +931,8 @@ gegl_affine_process (GeglOperation        *operation,
       src_rect.y += 1;
 
       sampler = op_affine_sampler (OP_AFFINE (operation));
-      src_rect.width -= sampler->context_rect.width;
-      src_rect.height -= sampler->context_rect.height;
+      src_rect.width -= sampler->context_rect[0].width;
+      src_rect.height -= sampler->context_rect[0].height;
 
       gegl_affine_fast_reflect_x (output, input, result, &src_rect);
 
@@ -957,8 +957,8 @@ gegl_affine_process (GeglOperation        *operation,
       src_rect.x += 1;
 
       sampler = op_affine_sampler (OP_AFFINE (operation));
-      src_rect.width -= sampler->context_rect.width;
-      src_rect.height -= sampler->context_rect.height;
+      src_rect.width -= sampler->context_rect[0].width;
+      src_rect.height -= sampler->context_rect[0].height;
 
       gegl_affine_fast_reflect_y (output, input, result, &src_rect);
 



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