Add arguments to prepare GEGL for being aware of scaling down previews.

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.
parent 1823b701
......@@ -598,6 +598,7 @@ gegl_buffer_set_unlocked (GeglBuffer *buffer,
void
gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect,
gint level,
const Babl *format,
void *src,
gint rowstride)
......@@ -1062,8 +1063,8 @@ gegl_buffer_get_unlocked (GeglBuffer *buffer,
void
gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect,
gdouble scale,
const Babl *format,
gpointer dest_buf,
gint rowstride)
......@@ -1169,7 +1170,7 @@ gegl_buffer_copy (GeglBuffer *src,
dest_rect_r.width = src_rect->width;
dest_rect_r.height = src_rect->height;
i = gegl_buffer_iterator_new (dst, &dest_rect_r, dst->format, GEGL_BUFFER_WRITE);
i = gegl_buffer_iterator_new (dst, &dest_rect_r, dst->format, GEGL_BUFFER_WRITE, 0); /* XXX: is level 0 right? */
read = gegl_buffer_iterator_add (i, src, src_rect, src->format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (i))
babl_process (fish, i->data[read], i->data[0], i->length);
......@@ -1201,7 +1202,7 @@ gegl_buffer_clear (GeglBuffer *dst,
/* FIXME: this can be even further optimized by special casing it so
* that fully voided tiles are dropped.
*/
i = gegl_buffer_iterator_new (dst, dst_rect, dst->format, GEGL_BUFFER_WRITE);
i = gegl_buffer_iterator_new (dst, dst_rect, dst->format, GEGL_BUFFER_WRITE, 0); /* XXX: should level be settable */
while (gegl_buffer_iterator_next (i))
{
memset (((guchar*)(i->data[0])), 0, i->length * pxsize);
......@@ -1266,7 +1267,7 @@ void gegl_buffer_set_color (GeglBuffer *dst,
/* FIXME: this can be even further optimized by special casing it so
* that fully filled tiles are shared.
*/
i = gegl_buffer_iterator_new (dst, dst_rect, dst->format, GEGL_BUFFER_WRITE);
i = gegl_buffer_iterator_new (dst, dst_rect, dst->format, GEGL_BUFFER_WRITE, 0);
while (gegl_buffer_iterator_next (i))
{
int j;
......
......@@ -102,7 +102,7 @@ gegl_buffer_cl_cache_merge (GeglBuffer *buffer,
if (cl_err != CL_SUCCESS) CL_ERROR;
/* tile-ize */
gegl_buffer_set (entry->buffer, &entry->roi, entry->buffer->format, data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (entry->buffer, &entry->roi, 0, entry->buffer->format, data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), entry->tex, data,
0, NULL, NULL);
......@@ -271,8 +271,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
gegl_rectangle_contains (&cb->roi, roi))
{
gegl_buffer_get (cb->buffer,
1.0,
roi,
1.0,
format,
dest_buf,
rowstride);
......@@ -310,7 +310,7 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
0, NULL, NULL, &cl_err);
if (cl_err != CL_SUCCESS) CL_ERROR;
gegl_buffer_set (cb->buffer, &entry->roi, format, data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (cb->buffer, &entry->roi, 0, format, data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), tex_dest, data,
0, NULL, NULL);
......@@ -320,8 +320,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
if (cl_err != CL_SUCCESS) CL_ERROR;
gegl_buffer_get (cb->buffer,
1.0,
roi,
1.0,
format,
dest_buf,
rowstride);
......
......@@ -252,7 +252,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion using BABL */
gegl_buffer_set (i->buffer[no], &i->roi[no][j], i->format[no], data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (i->buffer[no], &i->roi[no][j], 0, i->format[no], data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_op[no][j], data,
0, NULL, NULL);
......@@ -349,7 +349,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion using BABL */
gegl_buffer_get (i->buffer[no], 1.0, &i->roi[no][j], i->format[no], data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (i->buffer[no], &i->roi[no][j], 1.0, i->format[no], data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_op[no][j], data,
0, NULL, NULL);
......@@ -384,7 +384,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion will be performed in the GPU later */
gegl_buffer_get (i->buffer[no], 1.0, &i->roi[no][j], i->buffer[no]->format, data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (i->buffer[no], &i->roi[no][j], 1.0, i->buffer[no]->format, data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_buf[no][j], data,
0, NULL, NULL);
......@@ -420,7 +420,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion will be performed in the GPU later */
gegl_buffer_get (i->buffer[no], 1.0, &i->roi[no][j], i->buffer[no]->format, data, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (i->buffer[no], &i->roi[no][j], 1.0, i->buffer[no]->format, data, GEGL_AUTO_ROWSTRIDE);
cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_buf[no][j], data,
0, NULL, NULL);
......
......@@ -54,7 +54,7 @@ typedef struct GeglBufferTileIterator
GeglRectangle roi2; /* the rectangular subregion of data
* in the buffer represented by this scan.
*/
gint level;
} GeglBufferTileIterator;
#define GEGL_BUFFER_SCAN_COMPATIBLE 128 /* should be integrated into enum */
......@@ -86,7 +86,8 @@ typedef struct GeglBufferIterators
static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
GeglBuffer *buffer,
GeglRectangle roi,
gboolean write);
gboolean write,
gint level);
static gboolean gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i);
/*
......@@ -118,13 +119,15 @@ static gboolean gegl_buffer_scan_compatible (GeglBuffer *bufferA,
static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
GeglBuffer *buffer,
GeglRectangle roi,
gboolean write)
gboolean write,
gint level)
{
g_assert (i);
memset (i, 0, sizeof (GeglBufferTileIterator));
i->buffer = buffer;
i->roi = roi;
i->level = level;
i->next_row = 0;
i->next_col = 0;
i->tile = NULL;
......@@ -282,7 +285,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
if (self==0) /* The first buffer which is always scan aligned */
{
i->flags[self] |= GEGL_BUFFER_SCAN_COMPATIBLE;
gegl_buffer_tile_iterator_init (&i->i[self], i->buffer[self], i->rect[self], ((i->flags[self] & GEGL_BUFFER_WRITE) != 0) );
gegl_buffer_tile_iterator_init (&i->i[self], i->buffer[self], i->rect[self], ((i->flags[self] & GEGL_BUFFER_WRITE) != 0), iterator->level);
}
else
{
......@@ -294,7 +297,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
i->buffer[self], i->rect[self].x, i->rect[self].y))
{
i->flags[self] |= GEGL_BUFFER_SCAN_COMPATIBLE;
gegl_buffer_tile_iterator_init (&i->i[self], i->buffer[self], i->rect[self], ((i->flags[self] & GEGL_BUFFER_WRITE) != 0));
gegl_buffer_tile_iterator_init (&i->i[self], i->buffer[self], i->rect[self], ((i->flags[self] & GEGL_BUFFER_WRITE) != 0), iterator->level);
}
}
......@@ -308,7 +311,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
}
/* FIXME: we are currently leaking this buf pool, it should be
* freeing it when gegl is uninitialized
* freed when gegl is uninitialized
*/
typedef struct BufInfo {
......@@ -448,8 +451,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
if (i->flags[no] & GEGL_BUFFER_SCAN_COMPATIBLE &&
i->flags[no] & GEGL_BUFFER_FORMAT_COMPATIBLE &&
i->roi[no].width == i->i[no].buffer->tile_storage->tile_width && (i->flags[no] & GEGL_BUFFER_FORMAT_COMPATIBLE))
{
/* direct access */
{ /* direct access, don't need to do anything */
#if DEBUG_DIRECT
direct_write += i->roi[no].width * i->roi[no].height;
#endif
......@@ -465,7 +467,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
/* XXX: should perhaps use _set_unlocked, and keep the lock in the
* iterator.
*/
gegl_buffer_set (i->buffer[no], &(i->roi[no]), i->format[no], i->buf[no], GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (i->buffer[no], &(i->roi[no]), 0, i->format[no], i->buf[no], GEGL_AUTO_ROWSTRIDE); /* XXX: use correct level */
}
}
}
......@@ -551,11 +553,13 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
GeglBufferIterator *gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi,
const Babl *format,
guint flags)
guint flags,
gint level)
{
GeglBufferIterator *i = (gpointer)g_slice_new0 (GeglBufferIterators);
/* Because the iterator is nulled above, we can forgo explicitly setting
* i->is_finished to FALSE. */
i->level = level;
gegl_buffer_iterator_add (i, buffer, roi, format, flags);
return i;
}
......
......@@ -33,6 +33,7 @@ typedef struct GeglBufferIterator
gint length;
gpointer data[GEGL_BUFFER_MAX_ITERATORS];
GeglRectangle roi[GEGL_BUFFER_MAX_ITERATORS];
gint level;
} GeglBufferIterator;
......@@ -42,6 +43,8 @@ typedef struct GeglBufferIterator
* @roi: the rectangle to iterate over
* @format: the format we want to process this buffers data in, pass 0 to use the buffers format.
* @flags: whether we need reading or writing to this buffer one of GEGL_BUFFER_READ, GEGL_BUFFER_WRITE and GEGL_BUFFER_READWRITE.
* @level: the level at which we are iterating, the roi will indicate the
* extent at 1:1, x,y,width and height are/(2^level)
*
* Create a new buffer iterator, this buffer will be iterated through
* in linear chunks, some chunks might be full tiles the coordinates, see
......@@ -54,7 +57,10 @@ typedef struct GeglBufferIterator
GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi,
const Babl *format,
guint flags);
guint flags,
gint level); /* XXX: or encode it in flags? */
/* should maybe be reporting the roi in process, as base image roi when level != 0 */
/**
* gegl_buffer_iterator_add:
......
......@@ -244,7 +244,7 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
g_mutex_unlock (buffer->tile_storage->mutex);
/* XXX: potential race */
gegl_buffer_set (buffer, &info->extent, info->format, info->buf, 0);
gegl_buffer_set (buffer, &info->extent, 0, info->format, info->buf, 0);
gegl_free (info->buf);
g_free (info);
......
......@@ -217,10 +217,10 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer,
/**
* gegl_buffer_get:
* @buffer: the buffer to retrieve data from.
* @scale: sampling scale, 1.0 = pixel for pixel 2.0 = magnify, 0.5 scale down.
* @rect: the coordinates we want to retrieve data from, and width/height of
* destination buffer, if NULL equal to the extent of the buffer. The
* coordinates and dimensions are after scale has been applied.
* @scale: sampling scale, 1.0 = pixel for pixel 2.0 = magnify, 0.5 scale down.
* @format: the BablFormat to store in the linear buffer @dest.
* @dest: the memory destination for a linear buffer for the pixels, the size needed
* depends on the requested BablFormat.
......@@ -233,8 +233,8 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer,
* the tile structure into a linear buffer.
*/
void gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect,
gdouble scale,
const Babl *format,
gpointer dest,
gint rowstride);
......@@ -242,7 +242,11 @@ void gegl_buffer_get (GeglBuffer *buffer,
/**
* gegl_buffer_set:
* @buffer: the buffer to modify.
* @rect: the coordinates we want to change the data of and the width/height extent, if NULL equal to the extent of the buffer.
* @rect: the coordinates we want to change the data of and the width/height of
* the linear buffer being set, scale specifies the scaling factor applied to
* the data when setting.
* @scale_level: the scale level being set, 0 = 1:1 = default = base mipmap level,
* 1 = 1:2, 2=1:4, 3=1:8 ..
* @format: the babl_format the linear buffer @src.
* @src: linear buffer of image data to be stored in @buffer.
* @rowstride: rowstride in bytes, or GEGL_AUTO_ROWSTRIDE to compute the
......@@ -252,6 +256,7 @@ void gegl_buffer_get (GeglBuffer *buffer,
*/
void gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect,
gint scale_level,
const Babl *format,
void *src,
gint rowstride);
......
......@@ -277,8 +277,8 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
}
gegl_buffer_get (sampler->buffer,
1.0,
&fetch_rectangle,
1.0,
sampler->interpolate_format,
sampler->sampler_buffer[0],
GEGL_AUTO_ROWSTRIDE);
......@@ -351,8 +351,8 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
}
gegl_buffer_get (sampler->buffer,
1.0,
&fetch_rectangle,
1.0,
sampler->interpolate_format,
sampler->sampler_buffer[0],
GEGL_AUTO_ROWSTRIDE);
......@@ -446,8 +446,8 @@ gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
}
gegl_buffer_get (sampler->buffer,
scale,
&fetch_rectangle,
scale,
sampler->interpolate_format,
sampler->sampler_buffer[level],
GEGL_AUTO_ROWSTRIDE);
......
......@@ -73,6 +73,7 @@ GType gegl_module_register_type (GTypeModule *module,
const GTypeInfo *type_info,
GTypeFlags flags);
gint gegl_operation_context_get_level (GeglOperationContext *self);
GeglBuffer *gegl_operation_context_get_source (GeglOperationContext *self,
const gchar *padname);
GeglBuffer *gegl_operation_context_get_target (GeglOperationContext *self,
......
......@@ -896,7 +896,7 @@ static void spawnrender (gpointer data,
if ((buffer ) && td->destination_buf)
{
gegl_buffer_get (buffer, 1.0, &td->roi, td->format, td->destination_buf, td->rowstride);
gegl_buffer_get (buffer, &td->roi, 1.0, td->format, td->destination_buf, td->rowstride);
}
/* and unrefing to ultimately clean it off from the graph */
......@@ -1056,7 +1056,7 @@ gegl_node_blit (GeglNode *self,
}
if (destination_buf && cache)
{
gegl_buffer_get (GEGL_BUFFER (cache), scale, roi,
gegl_buffer_get (GEGL_BUFFER (cache), roi, scale,
format, destination_buf, rowstride);
}
}
......
......@@ -50,7 +50,8 @@ static void set_property (GObject *gobject,
static gboolean gegl_operation_composer_process (GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result);
const GeglRectangle *result,
gint level);
static void attach (GeglOperation *operation);
static GeglNode*detect (GeglOperation *operation,
gint x,
......@@ -144,10 +145,11 @@ 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,
gint level)
{
GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
GeglBuffer *input;
......@@ -171,7 +173,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);
......
......@@ -50,7 +50,8 @@ struct _GeglOperationComposerClass
GeglBuffer *input,
GeglBuffer *aux,
GeglBuffer *output,
const GeglRectangle *result);
const GeglRectangle *result,
gint level);
gpointer pad[4];
};
......
......@@ -52,7 +52,8 @@ static gboolean gegl_operation_composer3_process
(GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result);
const GeglRectangle *result,
gint level);
static void attach (GeglOperation *operation);
static GeglNode*detect (GeglOperation *operation,
gint x,
......@@ -161,7 +162,8 @@ static gboolean
gegl_operation_composer3_process (GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
const GeglRectangle *result,
gint level)
{
GeglOperationComposer3Class *klass = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
GeglBuffer *input;
......@@ -188,7 +190,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);
......
......@@ -46,7 +46,8 @@ struct _GeglOperationComposer3Class
GeglBuffer *aux,
GeglBuffer *aux2,
GeglBuffer *output,
const GeglRectangle *result);
const GeglRectangle *result,
gint level);
gpointer pad[4];
};
......
......@@ -396,4 +396,7 @@ gegl_operation_context_get_target (GeglOperationContext *context,
return output;
}
gint gegl_operation_context_get_level (GeglOperationContext *ctxt)
{
return ctxt->level;
}
......@@ -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,
......@@ -89,6 +94,8 @@ GeglRectangle * gegl_operation_context_get_result_rect (GeglOperationContext *no
void gegl_operation_context_set_result_rect (GeglOperationContext *node,
const GeglRectangle *rect);
gint gegl_operation_context_get_level (GeglOperationContext *ctxt);
GeglOperationContext *gegl_operation_context_new (void);
void gegl_operation_context_destroy (GeglOperationContext *opcontext);
......
......@@ -49,10 +49,11 @@ static void set_property (GObject *gobject,
GParamSpec *pspec);
static gboolean gegl_operation_filter_process
(GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result);
(GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result,
gint level);
static void attach (GeglOperation *operation);
static GeglNode *detect (GeglOperation *operation,
......@@ -179,10 +180,11 @@ 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,
gint level)
{
GeglOperationFilterClass *klass;
GeglBuffer *input;
......@@ -202,7 +204,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);
......
......@@ -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];
};
......
......@@ -35,13 +35,15 @@ 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,
gint level);
G_DEFINE_TYPE (GeglOperationPointComposer, gegl_operation_point_composer, GEGL_TYPE_OPERATION_COMPOSER)
......@@ -86,7 +88,8 @@ static gboolean
gegl_operation_composer_process2 (GeglOperation *operation,
GeglOperationContext *context,
const gchar *output_prop,
const GeglRectangle *result)
const GeglRectangle *result,
gint level)
{
GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
GeglBuffer *input;
......@@ -121,7 +124,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);
......@@ -140,7 +143,8 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *aux,
GeglBuffer *output,
const GeglRectangle *result)
const GeglRectangle *result,
gint level)
{
const Babl *in_format = gegl_operation_get_format (operation, "input");
const Babl *aux_format = gegl_operation_get_format (operation, "aux");
......@@ -175,7 +179,7 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
for (j=0; j < i->n; j++)
{
cl_err = point_composer_class->cl_process(operation, i->tex[read][j], i->tex[foo][j], i->tex[0][j],
i->size[0][j], &i->roi[0][j]);
i->size[0][j], &i->roi[0][j], level);
if (cl_err != CL_SUCCESS)
{
GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s [GeglOperationPointComposer] Kernel",
......@@ -193,7 +197,7 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
for (j=0; j < i->n; j++)
{
cl_err = point_composer_class->cl_process(operation, i->tex[read][j], NULL, i->tex[0][j],
i->size[0][j], &i->roi[0][j]);
i->size[0][j], &i->roi[0][j], level);
if (cl_err != CL_SUCCESS)
{
GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s [GeglOperationPointComposer] Kernel",
......@@ -212,7 +216,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");
......@@ -223,12 +228,12 @@ gegl_operation_point_composer_process (GeglOperation *operation,
{
if (gegl_cl_is_accelerated () && point_composer_class->cl_process)
{
if (gegl_operation_point_composer_cl_process (operation, input, aux, output, result))
if (gegl_operation_point_composer_cl_process (operation, input, aux, output, result, level))
return TRUE;
}
{
GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE);
GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE, level);
gint read = /*output == input ? 0 :*/ gegl_buffer_iterator_add (i, input, result, in_format, GEGL_BUFFER_READ);
/* using separate read and write iterators for in-place ideally a single
* readwrite indice would be sufficient
......@@ -240,14 +245,14 @@ gegl_operation_point_composer_process (GeglOperation *operation,
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]));
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]));
point_composer_class->process (operation, i->data[read], NULL, i->data[0], i->length, &(i->roi[0]), level);
}
}
}
......
......@@ -55,15 +55,16 @@ 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,
cl_mem aux_tex,
cl_mem out_tex,