[gegl] make API of gegl_buffer_iterator more consistent
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] make API of gegl_buffer_iterator more consistent
- Date: Mon, 26 Mar 2012 16:32:16 +0000 (UTC)
commit 32f131df8340c6274230956de0405e348914fae4
Author: Ãyvind KolÃs <pippin gimp org>
Date: Mon Mar 26 17:07:54 2012 +0100
make API of gegl_buffer_iterator more consistent
Other buffer APIs have the level argument as the third argument after the
rect, also added the level argument to the add call.
gegl/buffer/gegl-buffer-access.c | 8 ++++----
gegl/buffer/gegl-buffer-iterator.c | 11 ++++++++---
gegl/buffer/gegl-buffer-iterator.h | 6 +++---
gegl/operation/gegl-operation-point-composer.c | 6 +++---
gegl/operation/gegl-operation-point-composer3.c | 10 +++++-----
gegl/operation/gegl-operation-point-filter.c | 4 ++--
gegl/operation/gegl-operation-point-render.c | 2 +-
operations/affine/affine.c | 2 +-
operations/common/map-absolute.c | 6 +++---
operations/common/map-relative.c | 6 +++---
operations/workshop/warp.c | 4 ++--
11 files changed, 35 insertions(+), 30 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 3646e14..5a0cb67 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1172,8 +1172,8 @@ 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->soft_format, GEGL_BUFFER_WRITE, 0); /* XXX: is level 0 right? */
- read = gegl_buffer_iterator_add (i, src, src_rect, src->soft_format, GEGL_BUFFER_READ);
+ i = gegl_buffer_iterator_new (dst, &dest_rect_r, 0, dst->soft_format, GEGL_BUFFER_WRITE);
+ read = gegl_buffer_iterator_add (i, src, src_rect, 0, src->soft_format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (i))
babl_process (fish, i->data[read], i->data[0], i->length);
}
@@ -1204,7 +1204,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->soft_format, GEGL_BUFFER_WRITE, 0); /* XXX: should level be settable */
+ i = gegl_buffer_iterator_new (dst, dst_rect, 0, dst->soft_format, GEGL_BUFFER_WRITE);
while (gegl_buffer_iterator_next (i))
{
memset (((guchar*)(i->data[0])), 0, i->length * pxsize);
@@ -1279,7 +1279,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->soft_format, GEGL_BUFFER_WRITE, 0);
+ i = gegl_buffer_iterator_new (dst, dst_rect, 0, dst->soft_format, GEGL_BUFFER_WRITE);
while (gegl_buffer_iterator_next (i))
{
int j;
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index 866e3bf..9d26657 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -253,6 +253,7 @@ gint
gegl_buffer_iterator_add (GeglBufferIterator *iterator,
GeglBuffer *buffer,
const GeglRectangle *roi,
+ gint level,
const Babl *format,
guint flags)
{
@@ -268,6 +269,10 @@ gegl_buffer_iterator_add (GeglBufferIterator *iterator,
memset (i, 0, sizeof (GeglBufferIterators));
}
+ /* XXX: should assert that the passed in level matches
+ * the level of the base iterator.
+ */
+
self = i->iterators++;
if (!roi)
@@ -552,15 +557,15 @@ gegl_buffer_iterator_next (GeglBufferIterator *iterator)
GeglBufferIterator *gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi,
+ gint level,
const Babl *format,
- guint flags,
- gint level)
+ guint flags)
{
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);
+ gegl_buffer_iterator_add (i, buffer, roi, level, format, flags);
return i;
}
diff --git a/gegl/buffer/gegl-buffer-iterator.h b/gegl/buffer/gegl-buffer-iterator.h
index 645d425..6dd2408 100644
--- a/gegl/buffer/gegl-buffer-iterator.h
+++ b/gegl/buffer/gegl-buffer-iterator.h
@@ -56,10 +56,9 @@ typedef struct GeglBufferIterator
*/
GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi,
+ gint level,
const Babl *format,
- 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 */
+ guint flags);
/**
@@ -81,6 +80,7 @@ GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
gint gegl_buffer_iterator_add (GeglBufferIterator *iterator,
GeglBuffer *buffer,
const GeglRectangle *roi,
+ gint level,
const Babl *format,
guint flags);
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index 055d797..b5a8276 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -233,15 +233,15 @@ gegl_operation_point_composer_process (GeglOperation *operation,
}
{
- 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);
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, level, out_format, GEGL_BUFFER_WRITE);
+ gint read = /*output == input ? 0 :*/ gegl_buffer_iterator_add (i, input, result, level, in_format, GEGL_BUFFER_READ);
/* using separate read and write iterators for in-place ideally a single
* readwrite indice would be sufficient
*/
if (aux)
{
- gint foo = gegl_buffer_iterator_add (i, aux, result, aux_format, GEGL_BUFFER_READ);
+ gint foo = gegl_buffer_iterator_add (i, aux, result, level, aux_format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (i))
{
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index fd62184..173a58f 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -160,15 +160,15 @@ gegl_operation_point_composer3_process (GeglOperation *operation,
if ((result->width > 0) && (result->height > 0))
{
- GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE, level);
- gint read = gegl_buffer_iterator_add (i, input, result, in_format, GEGL_BUFFER_READ);
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, level, out_format, GEGL_BUFFER_WRITE);
+ gint read = gegl_buffer_iterator_add (i, input, result, level, in_format, GEGL_BUFFER_READ);
if (aux)
{
- gint foo = gegl_buffer_iterator_add (i, aux, result, aux_format, GEGL_BUFFER_READ);
+ gint foo = gegl_buffer_iterator_add (i, aux, result, level, aux_format, GEGL_BUFFER_READ);
if (aux2)
{
- gint bar = gegl_buffer_iterator_add (i, aux2, result, aux2_format, GEGL_BUFFER_READ);
+ gint bar = gegl_buffer_iterator_add (i, aux2, result, level, aux2_format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (i))
{
@@ -187,7 +187,7 @@ gegl_operation_point_composer3_process (GeglOperation *operation,
{
if (aux2)
{
- gint bar = gegl_buffer_iterator_add (i, aux2, result, aux2_format, GEGL_BUFFER_READ);
+ gint bar = gegl_buffer_iterator_add (i, aux2, result, level, 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]), level);
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index a709a2e..5eb22bb 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -152,8 +152,8 @@ gegl_operation_point_filter_process (GeglOperation *operation,
}
{
- 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);
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, level, out_format, GEGL_BUFFER_WRITE);
+ gint read = /*output == input ? 0 :*/ gegl_buffer_iterator_add (i, input, result, level, in_format, GEGL_BUFFER_READ);
/* using separate read and write iterators for in-place ideally a single
* readwrite indice would be sufficient
*/
diff --git a/gegl/operation/gegl-operation-point-render.c b/gegl/operation/gegl-operation-point-render.c
index a98aa1f..e794530 100644
--- a/gegl/operation/gegl-operation-point-render.c
+++ b/gegl/operation/gegl-operation-point-render.c
@@ -97,7 +97,7 @@ gegl_operation_point_render_process (GeglOperation *operation,
if ((result->width > 0) && (result->height > 0))
{
- GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, out_format, GEGL_BUFFER_WRITE, level);
+ GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, level, out_format, GEGL_BUFFER_WRITE);
while (gegl_buffer_iterator_next (i))
point_render_class->process (operation, i->data[0], i->length, &i->roi[0], level);
diff --git a/operations/affine/affine.c b/operations/affine/affine.c
index c9ab3b1..88fab60 100644
--- a/operations/affine/affine.c
+++ b/operations/affine/affine.c
@@ -673,7 +673,7 @@ affine_generic (GeglBuffer *dest,
dest_extent = gegl_buffer_get_extent (dest);
- i = gegl_buffer_iterator_new (dest, dest_extent, format, GEGL_BUFFER_WRITE, level);
+ i = gegl_buffer_iterator_new (dest, dest_extent, level, format, GEGL_BUFFER_WRITE);
while (gegl_buffer_iterator_next (i))
{
GeglRectangle *roi = &i->roi[0];
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index 736cec3..a9e9042 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -73,11 +73,11 @@ process (GeglOperation *operation,
if (aux != NULL)
{
- it = gegl_buffer_iterator_new (output, result, format_io, GEGL_BUFFER_WRITE, level);
+ it = gegl_buffer_iterator_new (output, result, level, format_io, GEGL_BUFFER_WRITE);
index_out = 0;
- index_coords = gegl_buffer_iterator_add (it, aux, result, format_coords, GEGL_BUFFER_READ);
- index_in = gegl_buffer_iterator_add (it, input, result, format_io, GEGL_BUFFER_READ);
+ index_coords = gegl_buffer_iterator_add (it, aux, result, level, format_coords, GEGL_BUFFER_READ);
+ index_in = gegl_buffer_iterator_add (it, input, result, level, format_io, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (it))
{
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index 3d9f436..1adb105 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -77,11 +77,11 @@ process (GeglOperation *operation,
if (aux != NULL)
{
- it = gegl_buffer_iterator_new (output, result, format_io, GEGL_BUFFER_WRITE, level);
+ it = gegl_buffer_iterator_new (output, result, level, format_io, GEGL_BUFFER_WRITE);
index_out = 0;
- index_coords = gegl_buffer_iterator_add (it, aux, result, format_coords, GEGL_BUFFER_READ);
- index_in = gegl_buffer_iterator_add (it, input, result, format_io, GEGL_BUFFER_READ);
+ index_coords = gegl_buffer_iterator_add (it, aux, result, level, format_coords, GEGL_BUFFER_READ);
+ index_in = gegl_buffer_iterator_add (it, input, result, level, format_io, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (it))
{
diff --git a/operations/workshop/warp.c b/operations/workshop/warp.c
index abde861..be20020 100644
--- a/operations/workshop/warp.c
+++ b/operations/workshop/warp.c
@@ -218,7 +218,7 @@ stamp (GeglChantO *o,
{
gint pixel_count = 0;
- it = gegl_buffer_iterator_new (priv->buffer, &area, format, GEGL_BUFFER_READ, 0);
+ it = gegl_buffer_iterator_new (priv->buffer, &area, 0, format, GEGL_BUFFER_READ);
while (gegl_buffer_iterator_next (it))
{
@@ -237,7 +237,7 @@ stamp (GeglChantO *o,
y_mean /= pixel_count;
}
- it = gegl_buffer_iterator_new (priv->buffer, &area, format, GEGL_BUFFER_READWRITE, 0);
+ it = gegl_buffer_iterator_new (priv->buffer, &area, 0, format, GEGL_BUFFER_READWRITE);
while (gegl_buffer_iterator_next (it))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]