[gegl/pippin/wip/mipmap-prerenders: 1/5] add level argument to process functions



commit 998e599ee9c351766f73e3290fef4d25ed5167c0
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Sat Jun 4 03:42:31 2011 +0100

    add level argument to process functions
    
    Ignoring this argument should be valid, since it is added as the last argument
    to all functions where it might be used this is actually not an ABI change.

 gegl/operation/gegl-operation-composer.c        |   10 +-
 gegl/operation/gegl-operation-composer.h        |    3 +-
 gegl/operation/gegl-operation-composer3.c       |    2 +-
 gegl/operation/gegl-operation-composer3.h       |    3 +-
 gegl/operation/gegl-operation-context.h         |    5 +
 gegl/operation/gegl-operation-filter.c          |    8 +-
 gegl/operation/gegl-operation-filter.h          |    3 +-
 gegl/operation/gegl-operation-point-composer.c  |   30 ++-
 gegl/operation/gegl-operation-point-composer.h  |    4 +-
 gegl/operation/gegl-operation-point-composer3.c |   16 +-
 gegl/operation/gegl-operation-point-composer3.h |    4 +-
 gegl/operation/gegl-operation-point-filter.c    |   10 +-
 gegl/operation/gegl-operation-point-filter.h    |   12 +-
 gegl/operation/gegl-operation-point-render.c    |    8 +-
 gegl/operation/gegl-operation-point-render.h    |    3 +-
 gegl/operation/gegl-operation-sink.c            |    2 +-
 gegl/operation/gegl-operation-sink.h            |    3 +-
 gegl/operation/gegl-operation-source.c          |   16 +-
 gegl/operation/gegl-operation-source.h          |    3 +-
 gegl/operation/gegl-operation-temporal.c        |    5 +-
 gegl/operation/gegl-operation-temporal.h        |    3 +-
 gegl/operation/gegl-operation.c                 |    8 +-
 gegl/operation/gegl-operation.h                 |    4 +-
 gegl/process/gegl-processor.c                   |    3 +-
 operations/common/bilateral-filter.c            |    3 +-
 operations/common/box-blur.c                    |    3 +-
 operations/common/brightness-contrast.c         |    3 +-
 operations/common/buffer-sink.c                 |    3 +-
 operations/common/buffer-source.c               |    8 +-
 operations/common/c2g.c                         |    3 +-
 operations/common/checkerboard.c                |    3 +-
 operations/common/color-temperature.c           |    3 +-
 operations/common/color.c                       |    3 +-
 operations/common/contrast-curve.c              |    3 +-
 operations/common/edge-laplace.c                |    3 +-
 operations/common/edge-sobel.c                  |    3 +-
 operations/common/fattal02.c                    |    3 +-
 operations/common/fractal-explorer.c            |    3 +-
 operations/common/gaussian-blur.c               |    3 +-
 operations/common/gegl-buffer-save-op.c         |    3 +-
 operations/common/grey.c                        |    3 +-
 operations/common/grid.c                        |    3 +-
 operations/common/invert.c                      |    3 +-
 operations/common/levels.c                      |    3 +-
 operations/common/magick-load.c                 |    8 +-
 operations/common/mantiuk06.c                   |    7 +-
 operations/common/map-absolute.c                |    3 +-
 operations/common/map-relative.c                |    3 +-
 operations/common/mblur.c                       |    3 +-
 operations/common/mirrors.c                     |    3 +-
 operations/common/mono-mixer.c                  |    3 +-
 operations/common/motion-blur.c                 |    3 +-
 operations/common/noise.c                       |    3 +-
 operations/common/opacity.c                     |    3 +-
 operations/common/open-buffer.c                 |    8 +-
 operations/common/over.c                        |   13 +-
 operations/common/pixelise.c                    |    3 +-
 operations/common/raw-load.c                    |    8 +-
 operations/common/reinhard05.c                  |    3 +-
 operations/common/remap.c                       |    3 +-
 operations/common/snn-mean.c                    |    3 +-
 operations/common/stress.c                      |    3 +-
 operations/common/stretch-contrast.c            |    8 +-
 operations/common/svg-huerotate.c               |    3 +-
 operations/common/svg-luminancetoalpha.c        |    3 +-
 operations/common/svg-matrix.c                  |    3 +-
 operations/common/svg-saturate.c                |    3 +-
 operations/common/threshold.c                   |    3 +-
 operations/common/value-invert.c                |    3 +-
 operations/common/vignette.c                    |    3 +-
 operations/common/weighted-blend.c              |    3 +-
 operations/common/whitebalance.c                |    3 +-
 operations/common/write-buffer.c                |    3 +-
 operations/core/convert-format.c                |    3 +-
 operations/external/ff-load.c                   |    3 +-
 operations/external/jp2-load.c                  |    3 +-
 operations/external/jpg-load.c                  |    3 +-
 operations/external/matting-levin.c             |    3 +-
 operations/external/openraw.c                   |    3 +-
 operations/external/path.c                      |    3 +-
 operations/external/pixbuf.c                    |    3 +-
 operations/external/png-load.c                  |    3 +-
 operations/external/png-save.c                  |    3 +-
 operations/external/ppm-load.c                  |    3 +-
 operations/external/ppm-save.c                  |    3 +-
 operations/external/rgbe-load.c                 |    3 +-
 operations/external/rgbe-save.c                 |    3 +-
 operations/external/save-pixbuf.c               |    3 +-
 operations/external/sdl-display.c               |    3 +-
 operations/external/svg-load.c                  |    3 +-
 operations/external/text.c                      |    3 +-
 operations/external/v4l.c                       |    3 +-
 operations/external/vector-fill.c               |    3 +-
 operations/external/vector-stroke.c             |    3 +-
 operations/generated/math.rb                    |    3 +-
 operations/generated/other-blend.rb             |    3 +-
 operations/generated/svg-12-blend.rb            |    3 +-
 operations/generated/svg-12-porter-duff.rb      |    3 +-
 operations/workshop/box-max.c                   |    3 +-
 operations/workshop/box-min.c                   |    3 +-
 operations/workshop/box-percentile.c            |    3 +-
 operations/workshop/color-reduction.c           |    3 +-
 operations/workshop/demosaic-bimedian.c         |    3 +-
 operations/workshop/demosaic-simple.c           |    3 +-
 operations/workshop/disc-percentile.c           |    3 +-
 operations/workshop/external/ff-save.c          |    3 +-
 operations/workshop/external/gluas.c            |    3 +-
 operations/workshop/external/line-profile.c     |    3 +-
 operations/workshop/generated/blend.rb          |    3 +-
 operations/workshop/hstack.c                    |    6 +-
 operations/workshop/kuwahara-max.c              |    3 +-
 operations/workshop/kuwahara-min.c              |    3 +-
 operations/workshop/kuwahara.c                  |    3 +-
 operations/workshop/lens-correct.c              |  408 +++++++++++++++++++++++
 operations/workshop/linear-gradient.c           |    3 +-
 operations/workshop/mandelbrot.c                |    3 +-
 operations/workshop/max-rgb.c                   |    3 +-
 operations/workshop/noise-spread.c              |    3 +-
 operations/workshop/posterize.c                 |    3 +-
 operations/workshop/radial-gradient.c           |    3 +-
 operations/workshop/rawbayer-load.c             |   11 +-
 operations/workshop/snn-percentile.c            |    3 +-
 operations/workshop/unpremul.c                  |    3 +-
 operations/workshop/whirl-pinch.c               |    3 +-
 124 files changed, 727 insertions(+), 196 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index 708a188..6305e29 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -144,10 +144,10 @@ set_property (GObject      *object,
 }
 
 static gboolean
-gegl_operation_composer_process (GeglOperation       *operation,
-                        GeglOperationContext     *context,
-                        const gchar         *output_prop,
-                        const GeglRectangle *result)
+gegl_operation_composer_process (GeglOperation        *operation,
+                                 GeglOperationContext *context,
+                                 const gchar          *output_prop,
+                                 const GeglRectangle  *result)
 {
   GeglOperationComposerClass *klass   = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
   GeglBuffer                 *input;
@@ -171,7 +171,7 @@ gegl_operation_composer_process (GeglOperation       *operation,
   if (input != NULL ||
       aux != NULL)
     {
-      success = klass->process (operation, input, aux, output, result);
+      success = klass->process (operation, input, aux, output, result, context->level);
 
       if (output == GEGL_BUFFER (operation->node->cache))
         gegl_cache_computed (operation->node->cache, result);
diff --git a/gegl/operation/gegl-operation-composer.h b/gegl/operation/gegl-operation-composer.h
index 5df284f..812d99a 100644
--- a/gegl/operation/gegl-operation-composer.h
+++ b/gegl/operation/gegl-operation-composer.h
@@ -50,7 +50,8 @@ struct _GeglOperationComposerClass
                         GeglBuffer          *input,
                         GeglBuffer          *aux,
                         GeglBuffer          *output,
-                        const GeglRectangle *result);
+                        const GeglRectangle *result,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index ac77094..638986c 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -188,7 +188,7 @@ gegl_operation_composer3_process (GeglOperation        *operation,
       aux != NULL ||
       aux2 != NULL)
     {
-      success = klass->process (operation, input, aux, aux2, output, result);
+      success = klass->process (operation, input, aux, aux2, output, result, context->level);
 
       if (output == GEGL_BUFFER (operation->node->cache))
         gegl_cache_computed (operation->node->cache, result);
diff --git a/gegl/operation/gegl-operation-composer3.h b/gegl/operation/gegl-operation-composer3.h
index 6724a56..1ba31a0 100644
--- a/gegl/operation/gegl-operation-composer3.h
+++ b/gegl/operation/gegl-operation-composer3.h
@@ -46,7 +46,8 @@ struct _GeglOperationComposer3Class
                         GeglBuffer          *aux,
                         GeglBuffer          *aux2,
                         GeglBuffer          *output,
-                        const GeglRectangle *result);
+                        const GeglRectangle *result,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-context.h b/gegl/operation/gegl-operation-context.h
index ef50e2a..0262c24 100644
--- a/gegl/operation/gegl-operation-context.h
+++ b/gegl/operation/gegl-operation-context.h
@@ -55,6 +55,11 @@ struct _GeglOperationContext
                                   incorporated into the refcount of
                                   GeglOperationContext?
                                 */
+  gint           level;         /* subdivision level to render at, 0 = 1:1,
+                                                                   1 = 1:2,
+                                                                   2 = 1:4,
+                                                                   4 = 1:8,
+                                                                   6 = 1:16 .. */
 };
 
 GeglBuffer     *gegl_operation_context_get_target      (GeglOperationContext *self,
diff --git a/gegl/operation/gegl-operation-filter.c b/gegl/operation/gegl-operation-filter.c
index b56d3c0..b628eca 100644
--- a/gegl/operation/gegl-operation-filter.c
+++ b/gegl/operation/gegl-operation-filter.c
@@ -179,10 +179,10 @@ set_property (GObject      *object,
 }
 
 static gboolean
-gegl_operation_filter_process (GeglOperation   *operation,
+gegl_operation_filter_process (GeglOperation        *operation,
                                GeglOperationContext *context,
-                               const gchar     *output_prop,
-                               const GeglRectangle *result)
+                               const gchar          *output_prop,
+                               const GeglRectangle  *result)
 {
   GeglOperationFilterClass *klass;
   GeglBuffer               *input;
@@ -202,7 +202,7 @@ gegl_operation_filter_process (GeglOperation   *operation,
   input  = gegl_operation_context_get_source (context, "input");
   output = gegl_operation_context_get_target (context, "output");
 
-  success = klass->process (operation, input, output, result);
+  success = klass->process (operation, input, output, result, context->level);
 
   if (output == GEGL_BUFFER (operation->node->cache))
     gegl_cache_computed (operation->node->cache, result);
diff --git a/gegl/operation/gegl-operation-filter.h b/gegl/operation/gegl-operation-filter.h
index 1d51bb7..52e928a 100644
--- a/gegl/operation/gegl-operation-filter.h
+++ b/gegl/operation/gegl-operation-filter.h
@@ -48,7 +48,8 @@ struct _GeglOperationFilterClass
   gboolean (* process) (GeglOperation       *self,
                         GeglBuffer          *input,
                         GeglBuffer          *output,
-                        const GeglRectangle *roi);
+                        const GeglRectangle *roi,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index aa33a17..d376463 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -35,13 +35,14 @@ static gboolean gegl_operation_point_composer_process
                                GeglBuffer          *input,
                                GeglBuffer          *aux,
                                GeglBuffer          *output,
-                               const GeglRectangle *result);
+                               const GeglRectangle *result,
+                               gint                 level);
 
 static gboolean
-gegl_operation_composer_process2 (GeglOperation       *operation,
-                        GeglOperationContext     *context,
-                        const gchar         *output_prop,
-                        const GeglRectangle *result);
+gegl_operation_composer_process2 (GeglOperation        *operation,
+                                  GeglOperationContext *context,
+                                  const gchar          *output_prop,
+                                  const GeglRectangle  *result);
 
 G_DEFINE_TYPE (GeglOperationPointComposer, gegl_operation_point_composer, GEGL_TYPE_OPERATION_COMPOSER)
 
@@ -121,7 +122,7 @@ gegl_operation_composer_process2 (GeglOperation        *operation,
       success = done;
       if (!done)
         {
-          success = klass->process (operation, input, aux, output, result);
+          success = klass->process (operation, input, aux, output, result, context->level);
 
           if (output == GEGL_BUFFER (operation->node->cache))
             gegl_cache_computed (operation->node->cache, result);
@@ -212,7 +213,8 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
                                        GeglBuffer          *input,
                                        GeglBuffer          *aux,
                                        GeglBuffer          *output,
-                                       const GeglRectangle *result)
+                                       const GeglRectangle *result,
+                                       gint                 level)
 {
   GeglOperationPointComposerClass *point_composer_class = GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation);
   const Babl *in_format  = gegl_operation_get_format (operation, "input");
@@ -225,6 +227,20 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
         {
           if (gegl_operation_point_composer_cl_process (operation, input, aux, output, result))
             return TRUE;
+          /* XXX: this probably wrong when iterating on a different level */
+          gint foo = gegl_buffer_iterator_add (i, aux,  result, aux_format, GEGL_BUFFER_READ);
+
+          while (gegl_buffer_iterator_next (i))
+            {
+               point_composer_class->process (operation, i->data[read], i->data[foo], i->data[0], i->length, &(i->roi[0]), level);
+            }
+        }
+      else
+        {
+          while (gegl_buffer_iterator_next (i))
+            {
+               point_composer_class->process (operation, i->data[read], NULL, i->data[0], i->length, &(i->roi[0]), level);
+            }
         }
 
       {
diff --git a/gegl/operation/gegl-operation-point-composer.h b/gegl/operation/gegl-operation-point-composer.h
index f3d9a2f..249191f 100644
--- a/gegl/operation/gegl-operation-point-composer.h
+++ b/gegl/operation/gegl-operation-point-composer.h
@@ -55,8 +55,8 @@ struct _GeglOperationPointComposerClass
                         void                *aux,
                         void                *out,
                         glong                samples, /* number of samples   */
-                        const GeglRectangle *roi      /* rectangular region in output buffer */
-                        );
+                        const GeglRectangle *roi,     /* rectangular region in output buffer */
+                        gint                 level);
 
   cl_int   (* cl_process) (GeglOperation      *self,
                            cl_mem             in_tex,
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index d3771f0..b3fba7c 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -35,7 +35,8 @@ static gboolean gegl_operation_point_composer3_process
                                GeglBuffer          *aux,
                                GeglBuffer          *aux2,
                                GeglBuffer          *output,
-                               const GeglRectangle *result);
+                               const GeglRectangle *result,
+                               gint                 level);
 
 static gboolean
 gegl_operation_composer3_process2 (GeglOperation        *operation,
@@ -119,7 +120,7 @@ gegl_operation_composer3_process2 (GeglOperation        *operation,
       success = done;
       if (!done)
         {
-          success = klass->process (operation, input, aux, aux2, output, result);
+          success = klass->process (operation, input, aux, aux2, output, result, context->level);
 
           if (output == GEGL_BUFFER (operation->node->cache))
             gegl_cache_computed (operation->node->cache, result);
@@ -146,7 +147,8 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
                                         GeglBuffer          *aux,
                                         GeglBuffer          *aux2,
                                         GeglBuffer          *output,
-                                        const GeglRectangle *result)
+                                        const GeglRectangle *result,
+                                        gint                 level)
 {
   GeglOperationPointComposer3Class *point_composer3_class = GEGL_OPERATION_POINT_COMPOSER3_GET_CLASS (operation);
   const Babl *in_format   = gegl_operation_get_format (operation, "input");
@@ -168,14 +170,14 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
 
               while (gegl_buffer_iterator_next (i))
                 {
-                   point_composer3_class->process (operation, i->data[read], i->data[foo], i->data[bar], i->data[0], i->length, &(i->roi[0]));
+                   point_composer3_class->process (operation, i->data[read], i->data[foo], i->data[bar], i->data[0], i->length, &(i->roi[0]), level);
                 }
             }
           else
             {
               while (gegl_buffer_iterator_next (i))
                 {
-                   point_composer3_class->process (operation, i->data[read], i->data[foo], NULL, i->data[0], i->length, &(i->roi[0]));
+                   point_composer3_class->process (operation, i->data[read], i->data[foo], NULL, i->data[0], i->length, &(i->roi[0]), level);
                 }
             }
         }
@@ -186,14 +188,14 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
               gint bar = gegl_buffer_iterator_add (i, aux2,  result, aux2_format, GEGL_BUFFER_READ);
               while (gegl_buffer_iterator_next (i))
                 {
-                   point_composer3_class->process (operation, i->data[read], NULL, i->data[bar], i->data[0], i->length, &(i->roi[0]));
+                   point_composer3_class->process (operation, i->data[read], NULL, i->data[bar], i->data[0], i->length, &(i->roi[0]), level);
                 }
             }
           else
             {
               while (gegl_buffer_iterator_next (i))
                 {
-                   point_composer3_class->process (operation, i->data[read], NULL, NULL, i->data[0], i->length, &(i->roi[0]));
+                   point_composer3_class->process (operation, i->data[read], NULL, NULL, i->data[0], i->length, &(i->roi[0]), level);
                 }
             }
         }
diff --git a/gegl/operation/gegl-operation-point-composer3.h b/gegl/operation/gegl-operation-point-composer3.h
index 057fdb3..2d6a7ad 100644
--- a/gegl/operation/gegl-operation-point-composer3.h
+++ b/gegl/operation/gegl-operation-point-composer3.h
@@ -49,8 +49,8 @@ struct _GeglOperationPointComposer3Class
                         void                *aux2,
                         void                *out,
                         glong                samples, /* number of samples   */
-                        const GeglRectangle *roi      /* rectangular region in output buffer */
-                        );
+                        const GeglRectangle *roi,     /* rectangular region in output buffer */
+                        gint                 level);
 
   gpointer           pad[4];
 };
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index 67a8da1..c86da49 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -39,7 +39,8 @@ static gboolean gegl_operation_point_filter_process
                               (GeglOperation       *operation,
                                GeglBuffer          *input,
                                GeglBuffer          *output,
-                               const GeglRectangle *result);
+                               const GeglRectangle *result,
+                               gint                 level);
 
 static gboolean gegl_operation_point_filter_op_process
                               (GeglOperation       *operation,
@@ -131,7 +132,8 @@ static gboolean
 gegl_operation_point_filter_process (GeglOperation       *operation,
                                      GeglBuffer          *input,
                                      GeglBuffer          *output,
-                                     const GeglRectangle *result)
+                                     const GeglRectangle *result,
+                                     gint                 level)
 {
   const Babl *in_format  = gegl_operation_get_format (operation, "input");
   const Babl *out_format = gegl_operation_get_format (operation, "output");
@@ -154,7 +156,7 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
          * readwrite indice would be sufficient
          */
           while (gegl_buffer_iterator_next (i))
-            point_filter_class->process (operation, i->data[read], i->data[0], i->length, &i->roi[0]);
+            point_filter_class->process (operation, i->data[read], i->data[0], i->length, &i->roi[0], level);
       }
     }
   return TRUE;
@@ -203,7 +205,7 @@ static gboolean gegl_operation_point_filter_op_process
       output = gegl_operation_context_get_target (context, "output");
     }
 
-  success = gegl_operation_point_filter_process (operation, input, output, roi);
+  success = gegl_operation_point_filter_process (operation, input, output, roi, context->level);
   if (output == GEGL_BUFFER (operation->node->cache))
     gegl_cache_computed (operation->node->cache, roi);
 
diff --git a/gegl/operation/gegl-operation-point-filter.h b/gegl/operation/gegl-operation-point-filter.h
index 323c5a6..08e3671 100644
--- a/gegl/operation/gegl-operation-point-filter.h
+++ b/gegl/operation/gegl-operation-point-filter.h
@@ -54,16 +54,16 @@ struct _GeglOperationPointFilterClass
                         void               *in_buf,  /* input buffer      */
                         void               *out_buf, /* output buffer     */
                         glong               samples, /* number of samples */
-                        const GeglRectangle *roi);   /* rectangle out_buf spans
+                        const GeglRectangle *roi,    /* rectangle out_buf spans
                                                         in in buffer, see the
                                                         checkerboard op for
                                                         semantics */
-
-  cl_int   (* cl_process) (GeglOperation      *self,
-                           cl_mem             in_tex,
-                           cl_mem             out_tex,
-                           size_t             global_worksize,
+  cl_int   (* cl_process) (GeglOperation       *self,
+                           cl_mem               in_tex,
+                           cl_mem               out_tex,
+                           size_t               global_worksize,
                            const GeglRectangle *roi);
+                           gint                 level);
   gpointer                 pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-point-render.c b/gegl/operation/gegl-operation-point-render.c
index 74ab9fb..f822e3b 100644
--- a/gegl/operation/gegl-operation-point-render.c
+++ b/gegl/operation/gegl-operation-point-render.c
@@ -35,7 +35,8 @@
 static gboolean gegl_operation_point_render_process
                               (GeglOperation       *operation,
                                GeglBuffer          *output,
-                               const GeglRectangle *result);
+                               const GeglRectangle *result,
+                               gint                 level);
 
 G_DEFINE_TYPE (GeglOperationPointRender, gegl_operation_point_render, GEGL_TYPE_OPERATION_SOURCE)
 
@@ -77,7 +78,8 @@ gegl_operation_point_render_init (GeglOperationPointRender *self)
 static gboolean
 gegl_operation_point_render_process (GeglOperation       *operation,
                                      GeglBuffer          *output,
-                                     const GeglRectangle *result)
+                                     const GeglRectangle *result,
+                                     gint                 level)
 {
   GeglPad    *pad;
   const Babl *out_format;
@@ -98,7 +100,7 @@ gegl_operation_point_render_process (GeglOperation       *operation,
       GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE);
 
       while (gegl_buffer_iterator_next (i))
-          point_render_class->process (operation, i->data[0], i->length, &i->roi[0]);
+          point_render_class->process (operation, i->data[0], i->length, &i->roi[0], level);
     }
   return TRUE;
 }
diff --git a/gegl/operation/gegl-operation-point-render.h b/gegl/operation/gegl-operation-point-render.h
index ba7f79e..24237c3 100644
--- a/gegl/operation/gegl-operation-point-render.h
+++ b/gegl/operation/gegl-operation-point-render.h
@@ -50,7 +50,8 @@ struct _GeglOperationPointRenderClass
   gboolean (* process) (GeglOperation       *self,      /* for parameters    */
                         void                *out_buf,   /* output buffer     */
                         glong                samples,   /* number of samples */
-                        const GeglRectangle *roi);      /* can be used if position is of importance*/
+                        const GeglRectangle *roi,       /* can be used if position is of importance*/
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-sink.c b/gegl/operation/gegl-operation-sink.c
index 7c2b995..7ec06ca 100644
--- a/gegl/operation/gegl-operation-sink.c
+++ b/gegl/operation/gegl-operation-sink.c
@@ -135,7 +135,7 @@ gegl_operation_sink_process (GeglOperation        *operation,
       if (gegl_cl_is_accelerated ())
         gegl_buffer_cl_cache_invalidate (input, NULL);
 
-      success = klass->process (operation, input, result);
+      success = klass->process (operation, input, result, context->level);
       g_object_unref (input);
     }
 
diff --git a/gegl/operation/gegl-operation-sink.h b/gegl/operation/gegl-operation-sink.h
index 4441f75..7012ec5 100644
--- a/gegl/operation/gegl-operation-sink.h
+++ b/gegl/operation/gegl-operation-sink.h
@@ -53,7 +53,8 @@ struct _GeglOperationSinkClass
 
   gboolean (* process) (GeglOperation       *self,
                         GeglBuffer          *input,
-                        const GeglRectangle *roi);
+                        const GeglRectangle *roi,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-source.c b/gegl/operation/gegl-operation-source.c
index 8a2332f..cc11ecf 100644
--- a/gegl/operation/gegl-operation-source.c
+++ b/gegl/operation/gegl-operation-source.c
@@ -44,10 +44,10 @@ static void     set_property (GObject      *gobject,
                               const GValue *value,
                               GParamSpec   *pspec);
 static gboolean gegl_operation_source_process
-                             (GeglOperation *operation,
+                             (GeglOperation        *operation,
                               GeglOperationContext *context,
-                              const gchar   *output_prop,
-                              const GeglRectangle *result);
+                              const gchar          *output_prop,
+                              const GeglRectangle  *result);
 static void     attach       (GeglOperation *operation);
 
 
@@ -120,10 +120,10 @@ set_property (GObject      *object,
 }
 
 static gboolean
-gegl_operation_source_process (GeglOperation       *operation,
-                               GeglOperationContext     *context,
-                               const gchar         *output_prop,
-                               const GeglRectangle *result)
+gegl_operation_source_process (GeglOperation        *operation,
+                               GeglOperationContext *context,
+                               const gchar          *output_prop,
+                               const GeglRectangle  *result)
 {
   GeglOperationSourceClass *klass = GEGL_OPERATION_SOURCE_GET_CLASS (operation);
   GeglBuffer               *output;
@@ -137,7 +137,7 @@ gegl_operation_source_process (GeglOperation       *operation,
 
   g_assert (klass->process);
   output = gegl_operation_context_get_target (context, "output");
-  success = klass->process (operation, output, result);
+  success = klass->process (operation, output, result, context->level);
 
   if (output == GEGL_BUFFER (operation->node->cache))
     gegl_cache_computed (operation->node->cache, result);
diff --git a/gegl/operation/gegl-operation-source.h b/gegl/operation/gegl-operation-source.h
index 75a2c5a..a5585c0 100644
--- a/gegl/operation/gegl-operation-source.h
+++ b/gegl/operation/gegl-operation-source.h
@@ -48,7 +48,8 @@ struct _GeglOperationSourceClass
 
   gboolean (* process) (GeglOperation       *self,
                         GeglBuffer          *output,
-                        const GeglRectangle *roi);
+                        const GeglRectangle *roi,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation-temporal.c b/gegl/operation/gegl-operation-temporal.c
index ba5481d..655b6e6 100644
--- a/gegl/operation/gegl-operation-temporal.c
+++ b/gegl/operation/gegl-operation-temporal.c
@@ -89,7 +89,8 @@ gegl_operation_temporal_get_frame (GeglOperation *op,
 static gboolean gegl_operation_temporal_process (GeglOperation       *self,
                                                  GeglBuffer          *input,
                                                  GeglBuffer          *output,
-                                                 const GeglRectangle *result)
+                                                 const GeglRectangle *result,
+                                                 gint                 level)
 {
   GeglOperationTemporal *temporal = GEGL_OPERATION_TEMPORAL (self);
   GeglOperationTemporalPrivate *priv = temporal->priv;
@@ -112,7 +113,7 @@ static gboolean gegl_operation_temporal_process (GeglOperation       *self,
   }
 
  if (temporal_class->process)
-   return temporal_class->process (self, input, output, result);
+   return temporal_class->process (self, input, output, result, level);
  return FALSE;
 }
 
diff --git a/gegl/operation/gegl-operation-temporal.h b/gegl/operation/gegl-operation-temporal.h
index ef23747..d7058ee 100644
--- a/gegl/operation/gegl-operation-temporal.h
+++ b/gegl/operation/gegl-operation-temporal.h
@@ -51,7 +51,8 @@ struct _GeglOperationTemporalClass
   gboolean (* process) (GeglOperation       *self,
                         GeglBuffer          *input,
                         GeglBuffer          *output,
-                        const GeglRectangle *roi);
+                        const GeglRectangle *roi,
+                        gint                 level);
   gpointer              pad[4];
 };
 
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index a90460a..79d1b60 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -105,10 +105,10 @@ void gegl_node_emit_computed (GeglNode *node, const GeglRectangle *rect);
 
 
 gboolean
-gegl_operation_process (GeglOperation       *operation,
-                        GeglOperationContext     *context,
-                        const gchar         *output_pad,
-                        const GeglRectangle *result)
+gegl_operation_process (GeglOperation        *operation,
+                        GeglOperationContext *context,
+                        const gchar          *output_pad,
+                        const GeglRectangle  *result)
 {
   GeglOperationClass  *klass;
 
diff --git a/gegl/operation/gegl-operation.h b/gegl/operation/gegl-operation.h
index 4f157cb..66d0b9b 100644
--- a/gegl/operation/gegl-operation.h
+++ b/gegl/operation/gegl-operation.h
@@ -183,8 +183,8 @@ void            gegl_operation_attach        (GeglOperation *operation,
 void            gegl_operation_prepare       (GeglOperation *operation);
 gboolean        gegl_operation_process       (GeglOperation *operation,
                                               GeglOperationContext *context,
-                                              const gchar   *output_pad,
-                                              const GeglRectangle *roi);
+                                              const gchar          *output_pad,
+                                              const GeglRectangle  *roi);
 
 /* create a pad for a specified property for this operation, this method is
  * to be called from the attach method of operations, most operations do not
diff --git a/gegl/process/gegl-processor.c b/gegl/process/gegl-processor.c
index 1c69be7..45ec51b 100644
--- a/gegl/process/gegl-processor.c
+++ b/gegl/process/gegl-processor.c
@@ -784,8 +784,7 @@ gegl_processor_work (GeglProcessor *processor,
       gegl_operation_process (processor->node->operation,
                               processor->context,
                               "output"  /* ignored output_pad */,
-                              &processor->context->result_rect
-                              );
+                              &processor->context->result_rect);
       gegl_node_remove_context (processor->node, cache);
       processor->context = NULL;
 
diff --git a/operations/common/bilateral-filter.c b/operations/common/bilateral-filter.c
index 7ee9cbb..3aa0efc 100644
--- a/operations/common/bilateral-filter.c
+++ b/operations/common/bilateral-filter.c
@@ -61,7 +61,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle compute;
diff --git a/operations/common/box-blur.c b/operations/common/box-blur.c
index 21f55d1..0853c72 100644
--- a/operations/common/box-blur.c
+++ b/operations/common/box-blur.c
@@ -362,7 +362,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglRectangle rect;
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
diff --git a/operations/common/brightness-contrast.c b/operations/common/brightness-contrast.c
index ce8b207..ffe4d48 100644
--- a/operations/common/brightness-contrast.c
+++ b/operations/common/brightness-contrast.c
@@ -75,7 +75,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   /* Retrieve a pointer to GeglChantO structure which contains all the
    * chanted properties
diff --git a/operations/common/buffer-sink.c b/operations/common/buffer-sink.c
index c245846..841230e 100644
--- a/operations/common/buffer-sink.c
+++ b/operations/common/buffer-sink.c
@@ -37,7 +37,8 @@ gegl_chant_pointer (format, _("babl format"),
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/common/buffer-source.c b/operations/common/buffer-source.c
index eb103b0..315049b 100644
--- a/operations/common/buffer-source.c
+++ b/operations/common/buffer-source.c
@@ -55,10 +55,10 @@ get_bounding_box (GeglOperation *operation)
 }
 
 static gboolean
-process (GeglOperation       *operation,
-         GeglOperationContext     *context,
-         const gchar         *output_pad,
-         const GeglRectangle *result)
+process (GeglOperation        *operation,
+         GeglOperationContext *context,
+         const gchar          *output_pad,
+         const GeglRectangle  *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/common/c2g.c b/operations/common/c2g.c
index 093dbbd..ced5e98 100644
--- a/operations/common/c2g.c
+++ b/operations/common/c2g.c
@@ -150,7 +150,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle compute;
diff --git a/operations/common/checkerboard.c b/operations/common/checkerboard.c
index a0f9174..9394b07 100644
--- a/operations/common/checkerboard.c
+++ b/operations/common/checkerboard.c
@@ -58,7 +58,8 @@ static gboolean
 process (GeglOperation       *operation,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/common/color-temperature.c b/operations/common/color-temperature.c
index c61a9b6..5289d28 100644
--- a/operations/common/color-temperature.c
+++ b/operations/common/color-temperature.c
@@ -141,7 +141,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO   *o         = GEGL_CHANT_PROPERTIES (op);
   gfloat       *in_pixel  = in_buf;
diff --git a/operations/common/color.c b/operations/common/color.c
index 87c7950..0517d20 100644
--- a/operations/common/color.c
+++ b/operations/common/color.c
@@ -46,7 +46,8 @@ static gboolean
 gegl_color_op_process (GeglOperation       *operation,
                        void                *out_buf,
                        glong                n_pixels,
-                       const GeglRectangle *roi)
+                       const GeglRectangle *roi,
+                       gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/common/contrast-curve.c b/operations/common/contrast-curve.c
index 1dd6bd9..5daaca9 100644
--- a/operations/common/contrast-curve.c
+++ b/operations/common/contrast-curve.c
@@ -46,7 +46,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gint        num_sampling_points;
diff --git a/operations/common/edge-laplace.c b/operations/common/edge-laplace.c
index 3475d0b..30995f9 100644
--- a/operations/common/edge-laplace.c
+++ b/operations/common/edge-laplace.c
@@ -57,7 +57,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglRectangle compute;
 
diff --git a/operations/common/edge-sobel.c b/operations/common/edge-sobel.c
index d9f5e22..a8c735d 100644
--- a/operations/common/edge-sobel.c
+++ b/operations/common/edge-sobel.c
@@ -69,7 +69,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle compute;
diff --git a/operations/common/fattal02.c b/operations/common/fattal02.c
index abf172b..a727179 100644
--- a/operations/common/fattal02.c
+++ b/operations/common/fattal02.c
@@ -1243,7 +1243,8 @@ static gboolean
 fattal02_process (GeglOperation       *operation,
                   GeglBuffer          *input,
                   GeglBuffer          *output,
-                  const GeglRectangle *result)
+                  const GeglRectangle *result,
+                  gint                 level)
 {
   const GeglChantO *o     = GEGL_CHANT_PROPERTIES (operation);
   gfloat            noise;
diff --git a/operations/common/fractal-explorer.c b/operations/common/fractal-explorer.c
index 6fe3af6..1371629 100644
--- a/operations/common/fractal-explorer.c
+++ b/operations/common/fractal-explorer.c
@@ -418,7 +418,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   clrmap  colormap;
diff --git a/operations/common/gaussian-blur.c b/operations/common/gaussian-blur.c
index 57b986b..4c95ded 100644
--- a/operations/common/gaussian-blur.c
+++ b/operations/common/gaussian-blur.c
@@ -417,7 +417,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglRectangle rect;
   GeglBuffer *temp;
diff --git a/operations/common/gegl-buffer-save-op.c b/operations/common/gegl-buffer-save-op.c
index 55b88ae..bc7240a 100644
--- a/operations/common/gegl-buffer-save-op.c
+++ b/operations/common/gegl-buffer-save-op.c
@@ -34,7 +34,8 @@ gegl_chant_file_path (path, _("File"), "/tmp/gegl-buffer.gegl", _("Target file p
 static gboolean
 gegl_buffer_save_op_process (GeglOperation       *operation,
                              GeglBuffer          *input,
-                             const GeglRectangle *result)
+                             const GeglRectangle *result,
+                             gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/common/grey.c b/operations/common/grey.c
index bcda3cc..753ccf2 100644
--- a/operations/common/grey.c
+++ b/operations/common/grey.c
@@ -46,7 +46,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   float *in = in_buf;
   float *out = out_buf;
diff --git a/operations/common/grid.c b/operations/common/grid.c
index 8fe89c2..efa177b 100644
--- a/operations/common/grid.c
+++ b/operations/common/grid.c
@@ -59,7 +59,8 @@ static gboolean
 process (GeglOperation       *operation,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/common/invert.c b/operations/common/invert.c
index 448a45c..c4c6680 100644
--- a/operations/common/invert.c
+++ b/operations/common/invert.c
@@ -37,7 +37,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   glong   i;
   gfloat *in  = in_buf;
diff --git a/operations/common/levels.c b/operations/common/levels.c
index 1ff37fc..0410dc4 100644
--- a/operations/common/levels.c
+++ b/operations/common/levels.c
@@ -47,7 +47,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gfloat     *in_pixel;
diff --git a/operations/common/magick-load.c b/operations/common/magick-load.c
index c3caa22..546a94b 100644
--- a/operations/common/magick-load.c
+++ b/operations/common/magick-load.c
@@ -87,10 +87,10 @@ get_cached_region (GeglOperation *operation,
 }
 
 static gboolean
-process (GeglOperation       *operation,
-         GeglOperationContext     *context,
-         const gchar         *output_pad,
-         const GeglRectangle *result)
+process (GeglOperation         *operation,
+         GeglOperationContext  *context,
+         const gchar           *output_pad,
+         const GeglRectangle   *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/common/mantiuk06.c b/operations/common/mantiuk06.c
index 9dc91e8..404c624 100644
--- a/operations/common/mantiuk06.c
+++ b/operations/common/mantiuk06.c
@@ -1576,9 +1576,10 @@ mantiuk06_get_cached_region (GeglOperation        *operation,
 
 static gboolean
 mantiuk06_process (GeglOperation       *operation,
-                    GeglBuffer          *input,
-                    GeglBuffer          *output,
-                    const GeglRectangle *result)
+                   GeglBuffer          *input,
+                   GeglBuffer          *output,
+                   const GeglRectangle *result,
+                   gint                 level)
 {
   const GeglChantO *o          = GEGL_CHANT_PROPERTIES (operation);
   const gint        pix_stride = 4; /* RGBA */
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index 72a9340..01ea71b 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -57,7 +57,8 @@ process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *aux,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO           *o = GEGL_CHANT_PROPERTIES (operation);
   const Babl           *format_io, *format_coords;
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index 0b79845..5736c10 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -61,7 +61,8 @@ process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *aux,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO           *o = GEGL_CHANT_PROPERTIES (operation);
   const Babl           *format_io, *format_coords;
diff --git a/operations/common/mblur.c b/operations/common/mblur.c
index 3f4b774..e910a02 100644
--- a/operations/common/mblur.c
+++ b/operations/common/mblur.c
@@ -61,7 +61,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO          *o;
   Priv *p;
diff --git a/operations/common/mirrors.c b/operations/common/mirrors.c
index 04c6c69..516dd43 100644
--- a/operations/common/mirrors.c
+++ b/operations/common/mirrors.c
@@ -349,7 +349,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
diff --git a/operations/common/mono-mixer.c b/operations/common/mono-mixer.c
index 6b29003..0e4e20d 100644
--- a/operations/common/mono-mixer.c
+++ b/operations/common/mono-mixer.c
@@ -45,7 +45,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat      red   = o->red;
diff --git a/operations/common/motion-blur.c b/operations/common/motion-blur.c
index 9afb30b..1117696 100644
--- a/operations/common/motion-blur.c
+++ b/operations/common/motion-blur.c
@@ -72,7 +72,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglRectangle src_rect;
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
diff --git a/operations/common/noise.c b/operations/common/noise.c
index 26b5f65..a5cedc1 100644
--- a/operations/common/noise.c
+++ b/operations/common/noise.c
@@ -54,7 +54,8 @@ static gboolean
 process (GeglOperation       *operation,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/common/opacity.c b/operations/common/opacity.c
index 19f5f2a..f1adf2b 100644
--- a/operations/common/opacity.c
+++ b/operations/common/opacity.c
@@ -45,7 +45,8 @@ process (GeglOperation       *op,
          void                *aux_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat *in = in_buf;
   gfloat *out = out_buf;
diff --git a/operations/common/open-buffer.c b/operations/common/open-buffer.c
index e75105a..2293ece 100644
--- a/operations/common/open-buffer.c
+++ b/operations/common/open-buffer.c
@@ -73,10 +73,10 @@ get_cached_region (GeglOperation       *self,
 }
 
 static gboolean
-process (GeglOperation       *operation,
-         GeglOperationContext     *context,
-         const gchar         *output_pad,
-         const GeglRectangle *result)
+process (GeglOperation           *operation,
+         GeglOperationContext  *context,
+         const gchar           *output_pad,
+         const GeglRectangle   *result)
 {
   GeglBuffer *buffer = ensure_buffer (operation);
 
diff --git a/operations/common/over.c b/operations/common/over.c
index 092af65..76669f6 100644
--- a/operations/common/over.c
+++ b/operations/common/over.c
@@ -41,12 +41,13 @@ static void prepare (GeglOperation *operation)
 }
 
 static gboolean
-process (GeglOperation        *op,
-          void                *in_buf,
-          void                *aux_buf,
-          void                *out_buf,
-          glong                n_pixels,
-          const GeglRectangle *roi)
+process (GeglOperation       *op,
+         void                *in_buf,
+         void                *aux_buf,
+         void                *out_buf,
+         glong                n_pixels,
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gint i;
   gfloat * GEGL_ALIGNED in = in_buf;
diff --git a/operations/common/pixelise.c b/operations/common/pixelise.c
index 664a41d..524c177 100644
--- a/operations/common/pixelise.c
+++ b/operations/common/pixelise.c
@@ -134,7 +134,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglRectangle src_rect;
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
diff --git a/operations/common/raw-load.c b/operations/common/raw-load.c
index 334a041..4690bc2 100644
--- a/operations/common/raw-load.c
+++ b/operations/common/raw-load.c
@@ -124,10 +124,10 @@ get_bounding_box (GeglOperation *operation)
 }
 
 static gboolean
-process (GeglOperation       *operation,
-         GeglOperationContext     *context,
-         const gchar         *output_pad,
-         const GeglRectangle *result)
+process (GeglOperation         *operation,
+         GeglOperationContext  *context,
+         const gchar           *output_pad,
+         const GeglRectangle   *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer *output;
diff --git a/operations/common/reinhard05.c b/operations/common/reinhard05.c
index 7b6931e..271dd34 100644
--- a/operations/common/reinhard05.c
+++ b/operations/common/reinhard05.c
@@ -120,7 +120,8 @@ static gboolean
 reinhard05_process (GeglOperation       *operation,
                     GeglBuffer          *input,
                     GeglBuffer          *output,
-                    const GeglRectangle *result)
+                    const GeglRectangle *result,
+                    gint                 level)
 {
   const GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/common/remap.c b/operations/common/remap.c
index beb30cd..7c1ef53 100644
--- a/operations/common/remap.c
+++ b/operations/common/remap.c
@@ -48,7 +48,8 @@ process (GeglOperation        *op,
           void                *max_buf,
           void                *out_buf,
           glong                n_pixels,
-          const GeglRectangle *roi)
+          const GeglRectangle *roi,
+          gint                 level)
 {
   gint i;
   gfloat *in = in_buf;
diff --git a/operations/common/snn-mean.c b/operations/common/snn-mean.c
index 6d8c57d..45cd96e 100644
--- a/operations/common/snn-mean.c
+++ b/operations/common/snn-mean.c
@@ -58,7 +58,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO          *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer          *temp_in;
diff --git a/operations/common/stress.c b/operations/common/stress.c
index cd840d4..cfa16b1 100644
--- a/operations/common/stress.c
+++ b/operations/common/stress.c
@@ -149,7 +149,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle compute;
diff --git a/operations/common/stretch-contrast.c b/operations/common/stretch-contrast.c
index 78e25de..c769010 100644
--- a/operations/common/stretch-contrast.c
+++ b/operations/common/stretch-contrast.c
@@ -33,7 +33,8 @@ static gboolean
 inner_process (gdouble  min,
                gdouble  max,
                gfloat  *buf,
-               gint     n_pixels)
+               gint     n_pixels,
+               gint     level)
 {
   gint o;
 
@@ -100,7 +101,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   gdouble  min, max;
 
@@ -124,7 +126,7 @@ process (GeglOperation       *operation,
         line.height = chunk;
 
         gegl_buffer_get (input, 1.0, &line, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
-        inner_process (min, max, buf, result->width  * chunk);
+        inner_process (min, max, buf, result->width  * chunk, level);
         gegl_buffer_set (output, &line, babl_format ("RGBA float"), buf,
                          GEGL_AUTO_ROWSTRIDE);
         consumed+=chunk;
diff --git a/operations/common/svg-huerotate.c b/operations/common/svg-huerotate.c
index 8161c94..4824d1e 100644
--- a/operations/common/svg-huerotate.c
+++ b/operations/common/svg-huerotate.c
@@ -48,7 +48,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o   = GEGL_CHANT_PROPERTIES (op);
   gfloat     *in  = in_buf;
diff --git a/operations/common/svg-luminancetoalpha.c b/operations/common/svg-luminancetoalpha.c
index c5a37df..1530565 100644
--- a/operations/common/svg-luminancetoalpha.c
+++ b/operations/common/svg-luminancetoalpha.c
@@ -48,7 +48,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat      *in = in_buf;
   gfloat      *out = out_buf;
diff --git a/operations/common/svg-matrix.c b/operations/common/svg-matrix.c
index 19768d4..c8a220b 100644
--- a/operations/common/svg-matrix.c
+++ b/operations/common/svg-matrix.c
@@ -48,7 +48,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gfloat     *in = in_buf;
diff --git a/operations/common/svg-saturate.c b/operations/common/svg-saturate.c
index c9d4b7d..9696508 100644
--- a/operations/common/svg-saturate.c
+++ b/operations/common/svg-saturate.c
@@ -48,7 +48,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gfloat     *in = in_buf;
diff --git a/operations/common/threshold.c b/operations/common/threshold.c
index f546c4d..9cd85a6 100644
--- a/operations/common/threshold.c
+++ b/operations/common/threshold.c
@@ -45,7 +45,8 @@ process (GeglOperation       *op,
          void                *aux_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat *in = in_buf;
   gfloat *out = out_buf;
diff --git a/operations/common/value-invert.c b/operations/common/value-invert.c
index 7a29df6..5d29664 100644
--- a/operations/common/value-invert.c
+++ b/operations/common/value-invert.c
@@ -51,7 +51,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   glong   j;
   gfloat *src  = in_buf;
diff --git a/operations/common/vignette.c b/operations/common/vignette.c
index 399aa05..d21a979 100644
--- a/operations/common/vignette.c
+++ b/operations/common/vignette.c
@@ -84,7 +84,8 @@ process (GeglOperation       *operation,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *in_pixel =  in_buf;
diff --git a/operations/common/weighted-blend.c b/operations/common/weighted-blend.c
index cf41c52..cd9ab05 100644
--- a/operations/common/weighted-blend.c
+++ b/operations/common/weighted-blend.c
@@ -46,7 +46,8 @@ process (GeglOperation       *op,
          void                *aux_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat *in  = in_buf;
   gfloat *out = out_buf;
diff --git a/operations/common/whitebalance.c b/operations/common/whitebalance.c
index e494d14..2eb31e2 100644
--- a/operations/common/whitebalance.c
+++ b/operations/common/whitebalance.c
@@ -50,7 +50,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gfloat     *in_pixel;
diff --git a/operations/common/write-buffer.c b/operations/common/write-buffer.c
index 8c4da4d..cec4272 100644
--- a/operations/common/write-buffer.c
+++ b/operations/common/write-buffer.c
@@ -36,7 +36,8 @@ gegl_chant_object (buffer, _("Buffer location"),
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/core/convert-format.c b/operations/core/convert-format.c
index 7fe4e81..f3ba46e 100644
--- a/operations/core/convert-format.c
+++ b/operations/core/convert-format.c
@@ -54,7 +54,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
 	int bpp = babl_format_get_bytes_per_pixel (gegl_operation_get_format (op, "output"));
 	memcpy(out_buf, in_buf, samples * bpp);
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index b5c735b..ce907e4 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -364,7 +364,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   Priv       *p = (Priv*)o->chant_data;
diff --git a/operations/external/jp2-load.c b/operations/external/jp2-load.c
index 5923430..6494d4d 100644
--- a/operations/external/jp2-load.c
+++ b/operations/external/jp2-load.c
@@ -167,7 +167,8 @@ prepare (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle rect = {0,0,0,0};
diff --git a/operations/external/jpg-load.c b/operations/external/jpg-load.c
index 90d7286..f0366e2 100644
--- a/operations/external/jpg-load.c
+++ b/operations/external/jpg-load.c
@@ -167,7 +167,8 @@ gegl_jpg_load_get_bounding_box (GeglOperation *operation)
 static gboolean
 gegl_jpg_load_process (GeglOperation       *operation,
                        GeglBuffer          *output,
-                       const GeglRectangle *result)
+                       const GeglRectangle *result,
+                       gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle        rect={0,0};
diff --git a/operations/external/matting-levin.c b/operations/external/matting-levin.c
index 1eb9e2a..c5f2dfd 100644
--- a/operations/external/matting-levin.c
+++ b/operations/external/matting-levin.c
@@ -1364,7 +1364,8 @@ matting_process (GeglOperation       *operation,
                  GeglBuffer          *input_buf,
                  GeglBuffer          *aux_buf,
                  GeglBuffer          *output_buf,
-                 const GeglRectangle *result)
+                 const GeglRectangle *result,
+                 gint                 level)
 {
   const GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gdouble          *input   = NULL,
diff --git a/operations/external/openraw.c b/operations/external/openraw.c
index 4ad1964..277fc7b 100644
--- a/operations/external/openraw.c
+++ b/operations/external/openraw.c
@@ -183,7 +183,8 @@ static gboolean
 process (GeglOperation          *operation,
          GeglOperationContext   *context,
          const gchar            *output_pad,
-         const GeglRectangle    *result)
+         const GeglRectangle    *result,
+         gint                    level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   g_assert (g_str_equal (output_pad, "output"));
diff --git a/operations/external/path.c b/operations/external/path.c
index 555be89..0cc1d3d 100644
--- a/operations/external/path.c
+++ b/operations/external/path.c
@@ -358,7 +358,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/external/pixbuf.c b/operations/external/pixbuf.c
index ef99a2b..b873738 100644
--- a/operations/external/pixbuf.c
+++ b/operations/external/pixbuf.c
@@ -61,7 +61,8 @@ static void prepare (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/external/png-load.c b/operations/external/png-load.c
index 90a6ab8..6c76746 100644
--- a/operations/external/png-load.c
+++ b/operations/external/png-load.c
@@ -391,7 +391,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gint        problem;
diff --git a/operations/external/png-save.c b/operations/external/png-save.c
index a7aee45..de7a98c 100644
--- a/operations/external/png-save.c
+++ b/operations/external/png-save.c
@@ -202,7 +202,8 @@ gegl_buffer_export_png (GeglBuffer  *gegl_buffer,
 static gboolean
 gegl_png_save_process (GeglOperation       *operation,
                        GeglBuffer          *input,
-                       const GeglRectangle *result)
+                       const GeglRectangle *result,
+                       gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/external/ppm-load.c b/operations/external/ppm-load.c
index 7134de1..646f22f 100644
--- a/operations/external/ppm-load.c
+++ b/operations/external/ppm-load.c
@@ -217,7 +217,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   FILE         *fp;
diff --git a/operations/external/ppm-save.c b/operations/external/ppm-save.c
index 6a63709..99276ff 100644
--- a/operations/external/ppm-save.c
+++ b/operations/external/ppm-save.c
@@ -115,7 +115,8 @@ ppm_save_write(FILE    *fp,
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *rect)
+         const GeglRectangle *rect,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/external/rgbe-load.c b/operations/external/rgbe-load.c
index c06e71c..ddb9f16 100644
--- a/operations/external/rgbe-load.c
+++ b/operations/external/rgbe-load.c
@@ -72,7 +72,8 @@ cleanup:
 static gboolean
 gegl_rgbe_load_process (GeglOperation       *operation,
                         GeglBuffer          *output,
-                        const GeglRectangle *result)
+                        const GeglRectangle *result,
+                        gint                 level)
 {
   GeglChantO       *o       = GEGL_CHANT_PROPERTIES (operation);
   gboolean          success = FALSE;
diff --git a/operations/external/rgbe-save.c b/operations/external/rgbe-save.c
index 2f65077..27234d3 100644
--- a/operations/external/rgbe-save.c
+++ b/operations/external/rgbe-save.c
@@ -41,7 +41,8 @@ static const gchar *FORMAT = "RGB float";
 static gboolean
 gegl_rgbe_save_process (GeglOperation       *operation,
                         GeglBuffer          *input,
-                        const GeglRectangle *rect)
+                        const GeglRectangle *rect,
+                        gint                 level)
 {
   GeglChantO *o       = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *pixels  = NULL;
diff --git a/operations/external/save-pixbuf.c b/operations/external/save-pixbuf.c
index cfadc5e..20848e7 100644
--- a/operations/external/save-pixbuf.c
+++ b/operations/external/save-pixbuf.c
@@ -39,7 +39,8 @@ gegl_chant_pointer (pixbuf, _("Pixbuf location"),
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/external/sdl-display.c b/operations/external/sdl-display.c
index dfde21f..0b850e3 100644
--- a/operations/external/sdl-display.c
+++ b/operations/external/sdl-display.c
@@ -81,7 +81,8 @@ static guint handle = 0;
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *source;
diff --git a/operations/external/svg-load.c b/operations/external/svg-load.c
index 75888e3..9511c1d 100644
--- a/operations/external/svg-load.c
+++ b/operations/external/svg-load.c
@@ -196,7 +196,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result_foo)
+         const GeglRectangle *result_foo,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gint        result;
diff --git a/operations/external/text.c b/operations/external/text.c
index 5489589..b09cb55 100644
--- a/operations/external/text.c
+++ b/operations/external/text.c
@@ -170,7 +170,8 @@ static void text_layout_text (GeglChant *self,
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChant *self = GEGL_CHANT (operation);
 
diff --git a/operations/external/v4l.c b/operations/external/v4l.c
index 62f7b44..528ad29 100644
--- a/operations/external/v4l.c
+++ b/operations/external/v4l.c
@@ -203,7 +203,8 @@ static gboolean update (gpointer operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   Priv       *p = (Priv*)o->chant_data;
diff --git a/operations/external/vector-fill.c b/operations/external/vector-fill.c
index 9f71166..60a5abf 100644
--- a/operations/external/vector-fill.c
+++ b/operations/external/vector-fill.c
@@ -116,7 +116,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gboolean need_fill = FALSE;
diff --git a/operations/external/vector-stroke.c b/operations/external/vector-stroke.c
index 29e7a04..fcbdeb3 100644
--- a/operations/external/vector-stroke.c
+++ b/operations/external/vector-stroke.c
@@ -143,7 +143,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gboolean need_stroke = FALSE;
diff --git a/operations/generated/math.rb b/operations/generated/math.rb
index 946ff9c..f1e1043 100755
--- a/operations/generated/math.rb
+++ b/operations/generated/math.rb
@@ -85,7 +85,8 @@ process (GeglOperation        *op,
           void                *aux_buf,
           void                *out_buf,
           glong                n_pixels,
-          const GeglRectangle *roi)
+          const GeglRectangle *roi,
+          gint                 level)
 {
   gfloat * GEGL_ALIGNED in = in_buf;
   gfloat * GEGL_ALIGNED out = out_buf;
diff --git a/operations/generated/other-blend.rb b/operations/generated/other-blend.rb
index a6eb5dc..a317e2a 100755
--- a/operations/generated/other-blend.rb
+++ b/operations/generated/other-blend.rb
@@ -68,7 +68,8 @@ process (GeglOperation        *op,
           void                *aux_buf,
           void                *out_buf,
           glong                n_pixels,
-          const GeglRectangle *roi)
+          const GeglRectangle *roi,
+          gint                 level)
 {
   gint i;
   gfloat * GEGL_ALIGNED in = in_buf;
diff --git a/operations/generated/svg-12-blend.rb b/operations/generated/svg-12-blend.rb
index b6ca188..0e7680f 100755
--- a/operations/generated/svg-12-blend.rb
+++ b/operations/generated/svg-12-blend.rb
@@ -97,7 +97,8 @@ process (GeglOperation       *op,
          void                *aux_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat * GEGL_ALIGNED in = in_buf;
   gfloat * GEGL_ALIGNED aux = aux_buf;
diff --git a/operations/generated/svg-12-porter-duff.rb b/operations/generated/svg-12-porter-duff.rb
index daac74a..dde24c9 100755
--- a/operations/generated/svg-12-porter-duff.rb
+++ b/operations/generated/svg-12-porter-duff.rb
@@ -88,7 +88,8 @@ process (GeglOperation        *op,
           void                *aux_buf,
           void                *out_buf,
           glong                n_pixels,
-          const GeglRectangle *roi)
+          const GeglRectangle *roi,
+          gint                 level)
 {
   gint i;
   gfloat * GEGL_ALIGNED in = in_buf;
diff --git a/operations/workshop/box-max.c b/operations/workshop/box-max.c
index 6d3af64..f4b08ce 100644
--- a/operations/workshop/box-max.c
+++ b/operations/workshop/box-max.c
@@ -164,7 +164,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle input_rect = gegl_operation_get_required_for_output (operation, "input", result);
diff --git a/operations/workshop/box-min.c b/operations/workshop/box-min.c
index 78f197c..8b4a9ba 100644
--- a/operations/workshop/box-min.c
+++ b/operations/workshop/box-min.c
@@ -164,7 +164,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle input_rect = gegl_operation_get_required_for_output (operation, "input", result);
diff --git a/operations/workshop/box-percentile.c b/operations/workshop/box-percentile.c
index bed6768..192bd79 100644
--- a/operations/workshop/box-percentile.c
+++ b/operations/workshop/box-percentile.c
@@ -59,7 +59,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/color-reduction.c b/operations/workshop/color-reduction.c
index 9153284..4890251 100644
--- a/operations/workshop/color-reduction.c
+++ b/operations/workshop/color-reduction.c
@@ -406,7 +406,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   guint       channel_bits [4];
diff --git a/operations/workshop/demosaic-bimedian.c b/operations/workshop/demosaic-bimedian.c
index 7841092..f8eb4b0 100644
--- a/operations/workshop/demosaic-bimedian.c
+++ b/operations/workshop/demosaic-bimedian.c
@@ -189,7 +189,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle src_rect = gegl_operation_get_required_for_output (operation, "input", result);
diff --git a/operations/workshop/demosaic-simple.c b/operations/workshop/demosaic-simple.c
index d570e22..561a687 100644
--- a/operations/workshop/demosaic-simple.c
+++ b/operations/workshop/demosaic-simple.c
@@ -120,7 +120,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle compute = gegl_operation_get_required_for_output (operation, "input", result);
diff --git a/operations/workshop/disc-percentile.c b/operations/workshop/disc-percentile.c
index 85db564..bb3b5bd 100644
--- a/operations/workshop/disc-percentile.c
+++ b/operations/workshop/disc-percentile.c
@@ -190,7 +190,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/external/ff-save.c b/operations/workshop/external/ff-save.c
index 68acf53..cedf3bf 100644
--- a/operations/workshop/external/ff-save.c
+++ b/operations/workshop/external/ff-save.c
@@ -805,7 +805,8 @@ filechanged (GeglChantOperation *op, const char *att)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   static gint inited = 0;
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
diff --git a/operations/workshop/external/gluas.c b/operations/workshop/external/gluas.c
index 43754b7..ebc5bf1 100644
--- a/operations/workshop/external/gluas.c
+++ b/operations/workshop/external/gluas.c
@@ -937,7 +937,8 @@ process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *aux,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
diff --git a/operations/workshop/external/line-profile.c b/operations/workshop/external/line-profile.c
index 583c11b..dfcfe4f 100644
--- a/operations/workshop/external/line-profile.c
+++ b/operations/workshop/external/line-profile.c
@@ -56,7 +56,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gint        width = MAX(MAX (o->width, o->x0), o->x1);
diff --git a/operations/workshop/generated/blend.rb b/operations/workshop/generated/blend.rb
index 60108fc..dcda16b 100755
--- a/operations/workshop/generated/blend.rb
+++ b/operations/workshop/generated/blend.rb
@@ -92,7 +92,8 @@ process (GeglOperation       *op,
          void                *aux_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   gfloat *in  = in_buf;
   gfloat *aux = aux_buf;
diff --git a/operations/workshop/hstack.c b/operations/workshop/hstack.c
index 084336c..2f2d47a 100644
--- a/operations/workshop/hstack.c
+++ b/operations/workshop/hstack.c
@@ -106,14 +106,12 @@ process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *aux,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
-  GeglOperationComposer *composer;
   GeglBuffer            *temp_in;
   GeglBuffer            *temp_aux;
 
-  composer = GEGL_OPERATION_COMPOSER (operation);
-
   /* FIXME: just pass the originals buffers if the result rectangle does not
    * include both input buffers
    */
diff --git a/operations/workshop/kuwahara-max.c b/operations/workshop/kuwahara-max.c
index a00bc4f..5adbe31 100644
--- a/operations/workshop/kuwahara-max.c
+++ b/operations/workshop/kuwahara-max.c
@@ -208,7 +208,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/kuwahara-min.c b/operations/workshop/kuwahara-min.c
index 520df23..64e5157 100644
--- a/operations/workshop/kuwahara-min.c
+++ b/operations/workshop/kuwahara-min.c
@@ -208,7 +208,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/kuwahara.c b/operations/workshop/kuwahara.c
index 7d0baa7..ca279a4 100644
--- a/operations/workshop/kuwahara.c
+++ b/operations/workshop/kuwahara.c
@@ -208,7 +208,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/lens-correct.c b/operations/workshop/lens-correct.c
new file mode 100644
index 0000000..2794b30
--- /dev/null
+++ b/operations/workshop/lens-correct.c
@@ -0,0 +1,408 @@
+/* This file is an image processing operation for GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
+ * Copyright 2008 Bradley Broom <bmbroom gmail com>
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+
+#ifdef GEGL_CHANT_PROPERTIES
+
+gegl_chant_pointer (lens_info_pointer, _("Model"),
+                    _("Pointer to LensCorrectionModel"))
+
+#else
+
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "lens-correct.c"
+
+#include "gegl-chant.h"
+#include <math.h>
+#include "lens-correct.h"
+
+#if 0
+#define TRACE       /* Define this to see basic tracing info. */
+#endif
+
+/* Find the src pixel that maps to the destination pixel passed as parameters x and y.
+ */
+static void
+find_src_pixel (LensCorrectionModel *lcip, ChannelCorrectionModel *pp,
+                gfloat x, gfloat y, gfloat *srcx, gfloat *srcy)
+{
+  double r, radj;
+
+  r = hypot (x - lcip->cx, y - lcip->cy) / lcip->rscale;
+  radj = (((pp->a*r+pp->b)*r+pp->c)*r+pp->d);
+  *srcx = (x - lcip->cx) * radj + lcip->cx;
+  *srcy = (y - lcip->cy) * radj + lcip->cy;
+}
+
+/* Find dst pixel that comes from the source pixel passed as parameters x and y.
+ */
+static void
+find_dst_pixel (LensCorrectionModel *lcip, ChannelCorrectionModel *pp,
+        gfloat x, gfloat y, gfloat *dstx, gfloat *dsty)
+{
+    /* Compute scaled distance of pixel from image center. */
+    gfloat srcr = hypot (x - lcip->cx, y - lcip->cy) / lcip->rscale;
+
+    /* Main path doesn't work for srcr == 0, but no need if pixel is close
+     * to image center.
+     */
+    if (srcr < 0.01/lcip->rscale) {
+        *dstx = x;
+    *dsty = y;
+    }
+    else {
+    gfloat dstr = srcr;
+        gfloat r;
+    #ifdef COUNT_IT
+      int it = 0;
+    #endif
+
+    /* Adjust dstr until r is within about one hundred of a pixel of srcr.
+     * Usually, one iteration is enough.
+     */
+    r = (((pp->a*dstr+pp->b)*dstr+pp->c)*dstr+pp->d) * dstr;
+    while (fabs (r - srcr) > 0.01/lcip->rscale) {
+        /* Compute derivative of lens distortion function at dstr. */
+            gfloat dr = ((4.0*pp->a*dstr+3.0*pp->b)*dstr+2.0*pp->c)*dstr+pp->d;
+        if (fabs(dr) < 1.0e-5) {
+        /* In theory, the derivative of a quartic function can have zeros,
+         * but I don't think any valid lens correction model will.
+         * Still, we check to avoid an infinite loop if the ChannelCorrectionModel is broken.
+         */
+            g_warning ("find_dst_pixel: x=%g y=%g found zero slope, bailing out", x, y);
+        break;
+        }
+        /* Adjust dstr based on error distance and current derivative. */
+        dstr += (srcr-r)/dr;
+        #ifdef COUNT_IT
+          it++;
+        #endif
+            r = (((pp->a*dstr+pp->b)*dstr+pp->c)*dstr+pp->d) * dstr;
+    }
+    #ifdef COUNT_IT
+      g_warning ("find_dst_pixel: iterations == %d", it);
+    #endif
+
+    /* Compute dst x,y coords from change in radial distance from image center. */
+    *dstx = (x - lcip->cx) * (dstr/srcr) + lcip->cx;
+    *dsty = (y - lcip->cy) * (dstr/srcr) + lcip->cy;
+    }
+}
+
+/* Define the type of the above two functions.
+ */
+typedef void pixel_map_func (LensCorrectionModel *lcip, ChannelCorrectionModel *pp,
+                 gfloat x, gfloat y, gfloat *dstx, gfloat *dsty);
+
+/* Compute the bounding box of the GeglRectangle, *in_rect,
+ * when passed through the pixel mapping function given by *mappix,
+ * using the LensCorrectionModel *lcip.
+ *
+ * The implementation assumes that the LensCorrectionModel is monotonic.
+ */
+static GeglRectangle
+map_region (const GeglRectangle *in_rect, LensCorrectionModel *lcip, pixel_map_func *mappix)
+{
+  GeglRectangle result = *in_rect;
+
+  #ifdef TRACE
+    g_warning ("> map_region in_rect=%dx%d+%d+%d", in_rect->width, in_rect->height, in_rect->x, in_rect->y);
+  #endif
+
+  if (result.width != 0 && result.height != 0)
+    {
+      gint ii;
+      gfloat x, y;
+      gfloat minx, miny, maxx, maxy;
+
+      /* To find the bounding box of the mapped pixels, we go around the
+       * perimeter of in_rect mapping each pixel.  By keeping track of
+       * the min/max x/y coordinates thus obtained, we compute the bounding box.
+       */
+      (*mappix) (lcip, &lcip->green, in_rect->x, in_rect->y, &minx, &miny);
+      maxx = minx; maxy = miny;
+      for (ii = 0; ii < 2*(in_rect->width+in_rect->height); ii++) {
+    /* Compute srcx,srcy coordinate for this point on the perimeter. */
+    gint srcx = in_rect->x;
+    gint srcy = in_rect->y;
+    if (ii < in_rect->width)
+      {
+        srcx += ii;
+      }
+    else if (ii < in_rect->width + in_rect->height)
+      {
+        srcx += in_rect->width;
+        srcy += (ii - in_rect->width);
+      }
+    else if (ii < 2*in_rect->width + in_rect->height)
+      {
+        srcy += in_rect->height;
+        srcx += 2*in_rect->width + in_rect->height - ii;
+      }
+    else
+      {
+        srcy += 2*(in_rect->width + in_rect->height) - ii;
+      }
+    /* Find dst pixels for each color channel. */
+        (*mappix) (lcip, &lcip->green, srcx, srcy, &x, &y);
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
+        (*mappix) (lcip, &lcip->red, srcx, srcy, &x, &y);
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
+        (*mappix) (lcip, &lcip->blue, srcx, srcy, &x, &y);
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
+      }
+      result.x = minx;
+      result.y = miny;
+      result.width = maxx - minx + 1;
+      result.height = maxy - miny + 1;
+    }
+  #ifdef TRACE
+    g_warning ("< map_region result=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
+  #endif
+  return result;
+}
+
+/* We expect src_extent to include all pixels required to form the
+ * pixels of dst_extent.
+ */
+#define ROW src_extent->width
+#define COL 1
+static void
+copy_through_lens (LensCorrectionModel *oip,
+                   GeglBuffer *src,
+                   GeglBuffer *dst)
+{
+  const GeglRectangle *src_extent;
+  const GeglRectangle *dst_extent;
+  gfloat *src_buf;
+  gfloat *dst_buf;
+  gint x,y;             /* Coordinate of current dst pixel. */
+  gint rgb;             /* Color channel of dst pixel being processed. */
+  gint doffset;             /* Buffer offset of current dst pixel. */
+  gint tmpx, tmpy, toff;
+  ChannelCorrectionModel *ccm[3];   /* Allow access to red,green,blue models in loop. */
+
+  src_extent = gegl_buffer_get_extent (src);
+  #ifdef TRACE
+    g_warning ("> copy_through_lens src_extent = %dx%d+%d+%d",
+                 src_extent->width, src_extent->height, src_extent->x,src_extent->y);
+  #endif
+  if (dst == NULL)
+    {
+      #ifdef TRACE
+        g_warning ("  dst is NULL");
+        g_warning ("< copy_through_lens");
+      #endif
+      return;
+    }
+  dst_extent = gegl_buffer_get_extent (dst);
+  if (dst_extent == NULL) {
+      #ifdef TRACE
+        g_warning ("  dst_extent is NULL");
+        g_warning ("< copy_through_lens");
+      #endif
+      return;
+  }
+
+  /* Get src pixels. */
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 3);
+  gegl_buffer_get (src, 1.0, NULL, babl_format ("RGB float"), src_buf, GEGL_AUTO_ROWSTRIDE);
+
+  /* Get buffer in which to place dst pixels. */
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 3);
+
+  /* Compute each dst pixel in turn and store into dst buffer. */
+  ccm[0] = &oip->red;
+  ccm[1] = &oip->green;
+  ccm[2] = &oip->blue;
+  doffset = 0;
+  for (y=dst_extent->y; y<dst_extent->height + dst_extent->y; y++)
+    {
+      for (x=dst_extent->x; x<dst_extent->width + dst_extent->x; x++)
+    {
+      for (rgb = 0; rgb < 3; rgb++)
+        {
+          gfloat gx, gy;
+          gfloat val = 0.0;
+          gint xx, yy;
+          gfloat wx[2], wy[2], wt = 0.0;
+
+          find_src_pixel (oip, ccm[rgb], (gfloat)x, (gfloat)y, &gx, &gy);
+          tmpx = gx;
+          tmpy = gy;
+          wx[1] = gx - tmpx;
+          wx[0] = 1.0 - wx[1];
+          wy[1] = gy - tmpy;
+          wy[0] = 1.0 - wy[1];
+          tmpx -= src_extent->x;
+          tmpy -= src_extent->y;
+          toff = (tmpy * ROW + tmpx) * 3;
+          for (xx = 0; xx < 2; xx++)
+            {
+          for (yy = 0; yy < 2; yy++)
+            {
+              if (tmpx+xx >= 0 && tmpx+xx < src_extent->width &&
+                  tmpy+yy >= 0 && tmpy+yy < src_extent->height)
+                {
+              val += src_buf[toff+(yy*ROW+xx)*3+rgb] * wx[xx] * wy[yy];
+              wt += wx[xx] * wy[yy];
+            }
+            }
+        }
+          if (wt <= 0)
+        {
+          g_warning ("gegl_lens_correct: mapped pixel %g,%g not in %dx%d+%d+%d", gx, gy,
+                 src_extent->width, src_extent->height, src_extent->x, src_extent->y);
+          g_warning ("                   dst = %dx%d+%d+%d", dst_extent->width, dst_extent->height, dst_extent->x,dst_extent->y);
+          dst_buf [doffset+rgb] = 0.0;
+        }
+          else
+        {
+          dst_buf [doffset+rgb] = val / wt;
+        }
+        }
+      doffset+=3;
+    }
+    }
+
+  /* Store dst pixels. */
+  gegl_buffer_set (dst, NULL, babl_format ("RGB float"), dst_buf, GEGL_AUTO_ROWSTRIDE);
+
+  /* Free acquired storage. */
+  g_free (src_buf);
+  g_free (dst_buf);
+
+  #ifdef TRACE
+    g_warning ("< copy_through_lens");
+  #endif
+}
+
+/*****************************************************************************/
+
+/* Compute the region for which this operation is defined.
+ */
+static GeglRectangle
+get_bounding_box (GeglOperation *operation)
+{
+  GeglRectangle  result = {0,0,0,0};
+  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
+  GeglChantO    *area = GEGL_CHANT_PROPERTIES (operation);
+
+  #ifdef TRACE
+    g_warning ("> get_bounding_box pointer == 0x%x in_rect == 0x%x", area->lens_info_pointer, in_rect);
+  #endif
+  if (in_rect && area->lens_info_pointer)
+    result = map_region (in_rect, area->lens_info_pointer, find_dst_pixel);
+
+  #ifdef TRACE
+    g_warning ("< get_bounding_box result = %dx%d+%d+%d", result.width, result.height, result.x, result.y);
+  #endif
+  return result;
+}
+
+/* Compute the input rectangle required to compute the specified region of interest (roi).
+ */
+static GeglRectangle
+get_required_for_output (GeglOperation        *operation,
+                         const gchar         *input_pad,
+                         const GeglRectangle *roi)
+{
+  GeglChantO   *area = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = *gegl_operation_source_get_bounding_box (operation, "input");
+  #ifdef TRACE
+    g_warning ("> get_required_for_output src=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
+    if (roi)
+      g_warning ("  ROI == %dx%d+%d+%d", roi->width, roi->height, roi->x, roi->y);
+  #endif
+  if (roi && area->lens_info_pointer) {
+    result = map_region (roi, area->lens_info_pointer, find_src_pixel);
+    result.width++;
+    result.height++;
+  }
+  #ifdef TRACE
+    g_warning ("< get_required_for_output res=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
+  #endif
+  return result;
+}
+
+/* Specify the input and output buffer formats.
+ */
+static void
+prepare (GeglOperation *operation)
+{
+  #ifdef TRACE
+    g_warning ("> prepare");
+  #endif
+  gegl_operation_set_format (operation, "input", babl_format ("RGB float"));
+  gegl_operation_set_format (operation, "output", babl_format ("RGB float"));
+  #ifdef TRACE
+    g_warning ("< prepare");
+  #endif
+}
+
+/* Perform the specified operation.
+ */
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result,
+         gint                 level)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+
+  copy_through_lens (o->lens_info_pointer, input, output);
+
+  return TRUE;
+}
+
+
+static void
+gegl_chant_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->get_bounding_box = get_bounding_box;
+  operation_class->get_required_for_output = get_required_for_output;
+
+  operation_class->name        = "gegl:lens-correct";
+  operation_class->categories  = "blur";
+  operation_class->description =
+        _("Copies image performing lens distortion correction.");
+}
+
+#endif
diff --git a/operations/workshop/linear-gradient.c b/operations/workshop/linear-gradient.c
index 4fe71d9..6bc289d 100644
--- a/operations/workshop/linear-gradient.c
+++ b/operations/workshop/linear-gradient.c
@@ -61,7 +61,8 @@ static gboolean
 process (GeglOperation       *operation,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/workshop/mandelbrot.c b/operations/workshop/mandelbrot.c
index e5df9d7..a84d654 100644
--- a/operations/workshop/mandelbrot.c
+++ b/operations/workshop/mandelbrot.c
@@ -82,7 +82,8 @@ get_bounding_box (GeglOperation *operation)
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *buf;
diff --git a/operations/workshop/max-rgb.c b/operations/workshop/max-rgb.c
index a8a952e..802cbec 100644
--- a/operations/workshop/max-rgb.c
+++ b/operations/workshop/max-rgb.c
@@ -49,7 +49,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
   gfloat     * GEGL_ALIGNED in_pixel;
diff --git a/operations/workshop/noise-spread.c b/operations/workshop/noise-spread.c
index caeea4c..5fc0399 100644
--- a/operations/workshop/noise-spread.c
+++ b/operations/workshop/noise-spread.c
@@ -133,7 +133,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
diff --git a/operations/workshop/posterize.c b/operations/workshop/posterize.c
index bd16361..d97dc07 100644
--- a/operations/workshop/posterize.c
+++ b/operations/workshop/posterize.c
@@ -42,7 +42,8 @@ static gboolean process (GeglOperation       *operation,
                          void                *in_buf,
                          void                *out_buf,
                          glong                samples,
-                         const GeglRectangle *roi)
+                         const GeglRectangle *roi,
+                         gint                 level)
 {
   GeglChantO *o      = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *src    = in_buf;
diff --git a/operations/workshop/radial-gradient.c b/operations/workshop/radial-gradient.c
index a23045f..5713836 100644
--- a/operations/workshop/radial-gradient.c
+++ b/operations/workshop/radial-gradient.c
@@ -61,7 +61,8 @@ static gboolean
 process (GeglOperation       *operation,
          void                *out_buf,
          glong                n_pixels,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   gfloat     *out_pixel = out_buf;
diff --git a/operations/workshop/rawbayer-load.c b/operations/workshop/rawbayer-load.c
index 8a95adc..49c7a16 100644
--- a/operations/workshop/rawbayer-load.c
+++ b/operations/workshop/rawbayer-load.c
@@ -109,11 +109,10 @@ get_bounding_box (GeglOperation *operation)
 }
 
 static gboolean
-process (GeglOperation       *operation,
-         GeglOperationContext     *context,
-         const gchar         *output_pad,
-         const GeglRectangle *result)
-
+process (GeglOperation        *operation,
+         GeglOperationContext *context,
+         const gchar          *output_pad,
+         const GeglRectangle  *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 #if 1
@@ -140,10 +139,8 @@ static void
 gegl_chant_class_init (GeglChantClass *klass)
 {
   GeglOperationClass       *operation_class;
-  GeglOperationSourceClass *source_class;
 
   operation_class = GEGL_OPERATION_CLASS (klass);
-  source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
   operation_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
diff --git a/operations/workshop/snn-percentile.c b/operations/workshop/snn-percentile.c
index cafe0bf..4a0e088 100644
--- a/operations/workshop/snn-percentile.c
+++ b/operations/workshop/snn-percentile.c
@@ -229,7 +229,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *temp_in;
diff --git a/operations/workshop/unpremul.c b/operations/workshop/unpremul.c
index 6d6883b..e463286 100644
--- a/operations/workshop/unpremul.c
+++ b/operations/workshop/unpremul.c
@@ -33,7 +33,8 @@ process (GeglOperation       *op,
          void                *in_buf,
          void                *out_buf,
          glong                samples,
-         const GeglRectangle *roi)
+         const GeglRectangle *roi,
+         gint                 level)
 {
   glong   i;
   gfloat *in  = in_buf;
diff --git a/operations/workshop/whirl-pinch.c b/operations/workshop/whirl-pinch.c
index 7967674..42cae34 100644
--- a/operations/workshop/whirl-pinch.c
+++ b/operations/workshop/whirl-pinch.c
@@ -215,7 +215,8 @@ static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
-         const GeglRectangle *result)
+         const GeglRectangle *result,
+         gint                 level)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle boundary = gegl_operation_get_bounding_box (operation);



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