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, ...@@ -598,6 +598,7 @@ gegl_buffer_set_unlocked (GeglBuffer *buffer,
void void
gegl_buffer_set (GeglBuffer *buffer, gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect, const GeglRectangle *rect,
gint level,
const Babl *format, const Babl *format,
void *src, void *src,
gint rowstride) gint rowstride)
...@@ -1062,8 +1063,8 @@ gegl_buffer_get_unlocked (GeglBuffer *buffer, ...@@ -1062,8 +1063,8 @@ gegl_buffer_get_unlocked (GeglBuffer *buffer,
void void
gegl_buffer_get (GeglBuffer *buffer, gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect, const GeglRectangle *rect,
gdouble scale,
const Babl *format, const Babl *format,
gpointer dest_buf, gpointer dest_buf,
gint rowstride) gint rowstride)
...@@ -1169,7 +1170,7 @@ gegl_buffer_copy (GeglBuffer *src, ...@@ -1169,7 +1170,7 @@ gegl_buffer_copy (GeglBuffer *src,
dest_rect_r.width = src_rect->width; dest_rect_r.width = src_rect->width;
dest_rect_r.height = src_rect->height; 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); read = gegl_buffer_iterator_add (i, src, src_rect, src->format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (i)) while (gegl_buffer_iterator_next (i))
babl_process (fish, i->data[read], i->data[0], i->length); babl_process (fish, i->data[read], i->data[0], i->length);
...@@ -1201,7 +1202,7 @@ gegl_buffer_clear (GeglBuffer *dst, ...@@ -1201,7 +1202,7 @@ gegl_buffer_clear (GeglBuffer *dst,
/* FIXME: this can be even further optimized by special casing it so /* FIXME: this can be even further optimized by special casing it so
* that fully voided tiles are dropped. * 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)) while (gegl_buffer_iterator_next (i))
{ {
memset (((guchar*)(i->data[0])), 0, i->length * pxsize); memset (((guchar*)(i->data[0])), 0, i->length * pxsize);
...@@ -1266,7 +1267,7 @@ void gegl_buffer_set_color (GeglBuffer *dst, ...@@ -1266,7 +1267,7 @@ void gegl_buffer_set_color (GeglBuffer *dst,
/* FIXME: this can be even further optimized by special casing it so /* FIXME: this can be even further optimized by special casing it so
* that fully filled tiles are shared. * 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)) while (gegl_buffer_iterator_next (i))
{ {
int j; int j;
......
...@@ -102,7 +102,7 @@ gegl_buffer_cl_cache_merge (GeglBuffer *buffer, ...@@ -102,7 +102,7 @@ gegl_buffer_cl_cache_merge (GeglBuffer *buffer,
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
/* tile-ize */ /* 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), entry->tex, data,
0, NULL, NULL); 0, NULL, NULL);
...@@ -271,8 +271,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer, ...@@ -271,8 +271,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
gegl_rectangle_contains (&cb->roi, roi)) gegl_rectangle_contains (&cb->roi, roi))
{ {
gegl_buffer_get (cb->buffer, gegl_buffer_get (cb->buffer,
1.0,
roi, roi,
1.0,
format, format,
dest_buf, dest_buf,
rowstride); rowstride);
...@@ -310,7 +310,7 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer, ...@@ -310,7 +310,7 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
0, NULL, NULL, &cl_err); 0, NULL, NULL, &cl_err);
if (cl_err != CL_SUCCESS) CL_ERROR; 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), tex_dest, data,
0, NULL, NULL); 0, NULL, NULL);
...@@ -320,8 +320,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer, ...@@ -320,8 +320,8 @@ gegl_buffer_cl_cache_from (GeglBuffer *buffer,
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
gegl_buffer_get (cb->buffer, gegl_buffer_get (cb->buffer,
1.0,
roi, roi,
1.0,
format, format,
dest_buf, dest_buf,
rowstride); rowstride);
......
...@@ -252,7 +252,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err) ...@@ -252,7 +252,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion using BABL */ /* 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_op[no][j], data,
0, NULL, NULL); 0, NULL, NULL);
...@@ -349,7 +349,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err) ...@@ -349,7 +349,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion using BABL */ /* 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_op[no][j], data,
0, NULL, NULL); 0, NULL, NULL);
...@@ -384,7 +384,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err) ...@@ -384,7 +384,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion will be performed in the GPU later */ /* 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_buf[no][j], data,
0, NULL, NULL); 0, NULL, NULL);
...@@ -420,7 +420,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err) ...@@ -420,7 +420,7 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
if (cl_err != CL_SUCCESS) CL_ERROR; if (cl_err != CL_SUCCESS) CL_ERROR;
/* color conversion will be performed in the GPU later */ /* 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, cl_err = gegl_clEnqueueUnmapMemObject (gegl_cl_get_command_queue(), i->tex_buf[no][j], data,
0, NULL, NULL); 0, NULL, NULL);
......
...@@ -54,7 +54,7 @@ typedef struct GeglBufferTileIterator ...@@ -54,7 +54,7 @@ typedef struct GeglBufferTileIterator
GeglRectangle roi2; /* the rectangular subregion of data GeglRectangle roi2; /* the rectangular subregion of data
* in the buffer represented by this scan. * in the buffer represented by this scan.
*/ */
gint level;
} GeglBufferTileIterator; } GeglBufferTileIterator;
#define GEGL_BUFFER_SCAN_COMPATIBLE 128 /* should be integrated into enum */ #define GEGL_BUFFER_SCAN_COMPATIBLE 128 /* should be integrated into enum */
...@@ -86,7 +86,8 @@ typedef struct GeglBufferIterators ...@@ -86,7 +86,8 @@ typedef struct GeglBufferIterators
static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i, static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
GeglBuffer *buffer, GeglBuffer *buffer,
GeglRectangle roi, GeglRectangle roi,
gboolean write); gboolean write,
gint level);
static gboolean gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i); static gboolean gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i);
/* /*
...@@ -118,13 +119,15 @@ static gboolean gegl_buffer_scan_compatible (GeglBuffer *bufferA, ...@@ -118,13 +119,15 @@ static gboolean gegl_buffer_scan_compatible (GeglBuffer *bufferA,
static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i, static void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
GeglBuffer *buffer, GeglBuffer *buffer,
GeglRectangle roi, GeglRectangle roi,
gboolean write) gboolean write,
gint level)
{ {
g_assert (i); g_assert (i);
memset (i, 0, sizeof (GeglBufferTileIterator)); memset (i, 0, sizeof (GeglBufferTileIterator));
i->buffer = buffer; i->buffer = buffer;
i->roi = roi; i->roi = roi;
i->level = level;
i->next_row = 0; i->next_row = 0;
i->next_col = 0; i->next_col = 0;
i->tile = NULL; i->tile = NULL;
...@@ -282,7 +285,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator, ...@@ -282,7 +285,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
if (self==0) /* The first buffer which is always scan aligned */ if (self==0) /* The first buffer which is always scan aligned */
{ {
i->flags[self] |= GEGL_BUFFER_SCAN_COMPATIBLE; 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 else
{ {
...@@ -294,7 +297,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator, ...@@ -294,7 +297,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
i->buffer[self], i->rect[self].x, i->rect[self].y)) i->buffer[self], i->rect[self].x, i->rect[self].y))
{ {
i->flags[self] |= GEGL_BUFFER_SCAN_COMPATIBLE; 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, ...@@ -308,7 +311,7 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
} }
/* FIXME: we are currently leaking this buf pool, it should be /* 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 { typedef struct BufInfo {
...@@ -448,8 +451,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator) ...@@ -448,8 +451,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
if (i->flags[no] & GEGL_BUFFER_SCAN_COMPATIBLE && if (i->flags[no] & GEGL_BUFFER_SCAN_COMPATIBLE &&
i->flags[no] & GEGL_BUFFER_FORMAT_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)) i->roi[no].width == i->i[no].buffer->tile_storage->tile_width && (i->flags[no] & GEGL_BUFFER_FORMAT_COMPATIBLE))
{ { /* direct access, don't need to do anything */
/* direct access */
#if DEBUG_DIRECT #if DEBUG_DIRECT
direct_write += i->roi[no].width * i->roi[no].height; direct_write += i->roi[no].width * i->roi[no].height;
#endif #endif
...@@ -465,7 +467,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator) ...@@ -465,7 +467,7 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
/* XXX: should perhaps use _set_unlocked, and keep the lock in the /* XXX: should perhaps use _set_unlocked, and keep the lock in the
* iterator. * 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) ...@@ -551,11 +553,13 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
GeglBufferIterator *gegl_buffer_iterator_new (GeglBuffer *buffer, GeglBufferIterator *gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi, const GeglRectangle *roi,
const Babl *format, const Babl *format,
guint flags) guint flags,
gint level)
{ {
GeglBufferIterator *i = (gpointer)g_slice_new0 (GeglBufferIterators); GeglBufferIterator *i = (gpointer)g_slice_new0 (GeglBufferIterators);
/* Because the iterator is nulled above, we can forgo explicitly setting /* Because the iterator is nulled above, we can forgo explicitly setting
* i->is_finished to FALSE. */ * i->is_finished to FALSE. */
i->level = level;
gegl_buffer_iterator_add (i, buffer, roi, format, flags); gegl_buffer_iterator_add (i, buffer, roi, format, flags);
return i; return i;
} }
......
...@@ -33,6 +33,7 @@ typedef struct GeglBufferIterator ...@@ -33,6 +33,7 @@ typedef struct GeglBufferIterator
gint length; gint length;
gpointer data[GEGL_BUFFER_MAX_ITERATORS]; gpointer data[GEGL_BUFFER_MAX_ITERATORS];
GeglRectangle roi[GEGL_BUFFER_MAX_ITERATORS]; GeglRectangle roi[GEGL_BUFFER_MAX_ITERATORS];
gint level;
} GeglBufferIterator; } GeglBufferIterator;
...@@ -42,6 +43,8 @@ typedef struct GeglBufferIterator ...@@ -42,6 +43,8 @@ typedef struct GeglBufferIterator
* @roi: the rectangle to iterate over * @roi: the rectangle to iterate over
* @format: the format we want to process this buffers data in, pass 0 to use the buffers format. * @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. * @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 * Create a new buffer iterator, this buffer will be iterated through
* in linear chunks, some chunks might be full tiles the coordinates, see * in linear chunks, some chunks might be full tiles the coordinates, see
...@@ -54,7 +57,10 @@ typedef struct GeglBufferIterator ...@@ -54,7 +57,10 @@ typedef struct GeglBufferIterator
GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer, GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi, const GeglRectangle *roi,
const Babl *format, 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: * gegl_buffer_iterator_add:
......
...@@ -244,7 +244,7 @@ gegl_buffer_linear_close (GeglBuffer *buffer, ...@@ -244,7 +244,7 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
g_mutex_unlock (buffer->tile_storage->mutex); g_mutex_unlock (buffer->tile_storage->mutex);
/* XXX: potential race */ /* 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); gegl_free (info->buf);
g_free (info); g_free (info);
......
...@@ -217,10 +217,10 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer, ...@@ -217,10 +217,10 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer,
/** /**
* gegl_buffer_get: * gegl_buffer_get:
* @buffer: the buffer to retrieve data from. * @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 * @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 * destination buffer, if NULL equal to the extent of the buffer. The
* coordinates and dimensions are after scale has been applied. * 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. * @format: the BablFormat to store in the linear buffer @dest.
* @dest: the memory destination for a linear buffer for the pixels, the size needed * @dest: the memory destination for a linear buffer for the pixels, the size needed
* depends on the requested BablFormat. * depends on the requested BablFormat.
...@@ -233,8 +233,8 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer, ...@@ -233,8 +233,8 @@ gboolean gegl_buffer_set_extent (GeglBuffer *buffer,
* the tile structure into a linear buffer. * the tile structure into a linear buffer.
*/ */
void gegl_buffer_get (GeglBuffer *buffer, void gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect, const GeglRectangle *rect,
gdouble scale,
const Babl *format, const Babl *format,
gpointer dest, gpointer dest,
gint rowstride); gint rowstride);
...@@ -242,7 +242,11 @@ void gegl_buffer_get (GeglBuffer *buffer, ...@@ -242,7 +242,11 @@ void gegl_buffer_get (GeglBuffer *buffer,
/** /**
* gegl_buffer_set: * gegl_buffer_set:
* @buffer: the buffer to modify. * @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. * @format: the babl_format the linear buffer @src.
* @src: linear buffer of image data to be stored in @buffer. * @src: linear buffer of image data to be stored in @buffer.
* @rowstride: rowstride in bytes, or GEGL_AUTO_ROWSTRIDE to compute the * @rowstride: rowstride in bytes, or GEGL_AUTO_ROWSTRIDE to compute the
...@@ -252,6 +256,7 @@ void gegl_buffer_get (GeglBuffer *buffer, ...@@ -252,6 +256,7 @@ void gegl_buffer_get (GeglBuffer *buffer,
*/ */
void gegl_buffer_set (GeglBuffer *buffer, void gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect, const GeglRectangle *rect,
gint scale_level,
const Babl *format, const Babl *format,
void *src, void *src,
gint rowstride); gint rowstride);
......
...@@ -277,8 +277,8 @@ gegl_sampler_get_ptr (GeglSampler *const sampler, ...@@ -277,8 +277,8 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
} }
gegl_buffer_get (sampler->buffer, gegl_buffer_get (sampler->buffer,
1.0,
&fetch_rectangle, &fetch_rectangle,
1.0,
sampler->interpolate_format, sampler->interpolate_format,
sampler->sampler_buffer[0], sampler->sampler_buffer[0],
GEGL_AUTO_ROWSTRIDE); GEGL_AUTO_ROWSTRIDE);
...@@ -351,8 +351,8 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler, ...@@ -351,8 +351,8 @@ gegl_sampler_get_from_buffer (GeglSampler *const sampler,
} }
gegl_buffer_get (sampler->buffer, gegl_buffer_get (sampler->buffer,
1.0,
&fetch_rectangle, &fetch_rectangle,
1.0,
sampler->interpolate_format, sampler->interpolate_format,
sampler->sampler_buffer[0], sampler->sampler_buffer[0],
GEGL_AUTO_ROWSTRIDE); GEGL_AUTO_ROWSTRIDE);
...@@ -446,8 +446,8 @@ gegl_sampler_get_from_mipmap (GeglSampler *const sampler, ...@@ -446,8 +446,8 @@ gegl_sampler_get_from_mipmap (GeglSampler *const sampler,
} }
gegl_buffer_get (sampler->buffer, gegl_buffer_get (sampler->buffer,
scale,
&fetch_rectangle, &fetch_rectangle,
scale,
sampler->interpolate_format, sampler->interpolate_format,
sampler->sampler_buffer[level], sampler->sampler_buffer[level],
GEGL_AUTO_ROWSTRIDE); GEGL_AUTO_ROWSTRIDE);
......
...@@ -73,6 +73,7 @@ GType gegl_module_register_type (GTypeModule *module, ...@@ -73,6 +73,7 @@ GType gegl_module_register_type (GTypeModule *module,
const GTypeInfo *type_info, const GTypeInfo *type_info,
GTypeFlags flags); GTypeFlags flags);
gint gegl_operation_context_get_level (GeglOperationContext *self);
GeglBuffer *gegl_operation_context_get_source (GeglOperationContext *self, GeglBuffer *gegl_operation_context_get_source (GeglOperationContext *self,
const gchar *padname); const gchar *padname);
GeglBuffer *gegl_operation_context_get_target (GeglOperationContext *self, GeglBuffer *gegl_operation_context_get_target (GeglOperationContext *self,
......
...@@ -896,7 +896,7 @@ static void spawnrender (gpointer data, ...@@ -896,7 +896,7 @@ static void spawnrender (gpointer data,
if ((buffer ) && td->destination_buf) 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 */ /* and unrefing to ultimately clean it off from the graph */
...@@ -1056,7 +1056,7 @@ gegl_node_blit (GeglNode *self, ...@@ -1056,7 +1056,7 @@ gegl_node_blit (GeglNode *self,
} }
if (destination_buf && cache) if (destination_buf && cache)
{ {
gegl_buffer_get (GEGL_BUFFER (cache), scale, roi, gegl_buffer_get (GEGL_BUFFER (cache), roi, scale,
format, destination_buf, rowstride); format, destination_buf, rowstride);
} }
} }
......
...@@ -50,7 +50,8 @@ static void set_property (GObject *gobject, ...@@ -50,7 +50,8 @@ static void set_property (GObject *gobject,
static gboolean gegl_operation_composer_process (GeglOperation *operation, static gboolean gegl_operation_composer_process (GeglOperation *operation,
GeglOperationContext *context, GeglOperationContext *context,
const gchar *output_prop, const gchar *output_prop,
const GeglRectangle *result); const GeglRectangle *result,
gint level);
static void attach (GeglOperation *operation); static void attach (GeglOperation *operation);
static GeglNode*detect (GeglOperation *operation, static GeglNode*detect (GeglOperation *operation,
gint x, gint x,
...@@ -144,10 +145,11 @@ set_property (GObject *object, ...@@ -144,10 +145,11 @@ set_property (GObject *object,
} }
static gboolean static gboolean
gegl_operation_composer_process (GeglOperation *operation, gegl_operation_composer_process (GeglOperation *operation,
GeglOperationContext *context, GeglOperationContext *context,
const gchar *output_prop, const gchar *output_prop,
const GeglRectangle *result) const GeglRectangle *result,
gint level)
{ {
GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation); GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
GeglBuffer *input; GeglBuffer *input;
...@@ -171,7 +173,7 @@ gegl_operation_composer_process (GeglOperation *operation, ...@@ -171,7 +173,7 @@ gegl_operation_composer_process (GeglOperation *operation,
if (input != NULL || if (input != NULL ||
aux != 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)) if (output == GEGL_BUFFER (operation->node->cache))
gegl_cache_computed (operation->node->cache, result); gegl_cache_computed (operation->node->cache, result);
......
...@@ -50,7 +50,8 @@ struct _GeglOperationComposerClass ...@@ -50,7 +50,8 @@ struct _GeglOperationComposerClass
GeglBuffer *input, GeglBuffer *input,
GeglBuffer *aux, GeglBuffer *aux,
GeglBuffer *output, GeglBuffer *output,
const GeglRectangle *result); const GeglRectangle *result,
gint level);
gpointer pad[4]; gpointer pad[4];
}; };
......
...@@ -52,7 +52,8 @@ static gboolean gegl_operation_composer3_process ...@@ -52,7 +52,8 @@ static gboolean gegl_operation_composer3_process
(GeglOperation *operation, (GeglOperation *operation,
GeglOperationContext *context, GeglOperationContext *context,
const gchar *output_prop, const gchar *output_prop,
const GeglRectangle *result); const GeglRectangle *result,
gint level);
static void attach (GeglOperation *operation); static void attach (GeglOperation *operation);
static GeglNode*detect (GeglOperation *operation, static GeglNode*detect (GeglOperation *operation,
gint x, gint x,
...@@ -161,7 +162,8 @@ static gboolean ...@@ -161,7 +162,8 @@ static gboolean
gegl_operation_composer3_process (GeglOperation *operation, gegl_operation_composer3_process (GeglOperation *operation,
GeglOperationContext *context, GeglOperationContext *context,
const gchar *output_prop, const gchar *output_prop,
const GeglRectangle *result) const GeglRectangle *result,
gint level)
{ {
GeglOperationComposer3Class *klass = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation); GeglOperationComposer3Class *klass = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
GeglBuffer *input; GeglBuffer *input;
...@@ -188,7 +190,7 @@ gegl_operation_composer3_process (GeglOperation *operation, ...@@ -188,7 +190,7 @@ gegl_operation_composer3_process (GeglOperation *operation,
aux != NULL || aux != NULL ||
aux2 != NULL)