Hi,
After an entire day hunting the bug, i provide a tiny fix to save-buffer
op that prevent it to eat all memory (due to default value in
GeglCache).
In the future, i may implement the tile by tile memcpy instead of all in
once as it is now. Attached the patch, with a ChangeLog entry ;).
Basically, the fix is just a modification on how to get input buffer
width, height, x and y. I just copyied the code from png-save which use
gegl_operation_result_rect() instead of using fake input buffer values.
I guess that the true fix would be to directly set input buffer
width,height,x and y to gegl_operation_result_rect() upstream regarding
to process().
This is my first patch to Gegl itself, not its build system :). I wish
i'll be able to contribute more and more in the future but, as you can
see, i prefer need public API in order to debug/improve Gegl because i'm
primarily Gnome Scan developer and this is by using Gegl in Gnome Scan i
will be able to find, hunt and fix bugs like this or add features like
dynamic per instance properties for GeglOperation.
Kind regards,
Étienne.
--
Verso l'Alto !
Index: operations/core/save-buffer.c
===================================================================
--- operations/core/save-buffer.c (révision 1474)
+++ operations/core/save-buffer.c (copie de travail)
@@ -53,25 +53,22 @@
if (self->buffer)
{
/*FIXME: iterate the buffer in chunks/tiles/spans instead of making a large
- * temporary linear buffer the size of the incoming buffe
+ * temporary linear buffer the size of the incoming buffer
*/
gpointer format;
guchar *temp;
- GeglRectangle rect;
+ GeglRectangle *rect = gegl_operation_result_rect (operation, context_id);
gint pxsize;
input = GEGL_BUFFER (gegl_operation_get_data (operation, context_id, "input"));
g_assert (input);
g_object_get (input, "px-size", &pxsize, NULL);
- gegl_rectangle_set (&rect, input->x, input->y, input->width, input->height);
-
-
- temp = g_malloc (input->width * input->height * pxsize);
+ /* pxsize is wrong, how to deal with ??? */
+ temp = g_malloc (rect->width * rect->height * pxsize);
format = input->format;
- gegl_buffer_get (input, &rect, 1.0, format, temp);
-
- gegl_buffer_set (GEGL_BUFFER (self->buffer), &rect, format, temp);
+ gegl_buffer_get (input, rect, 1.0, format, temp);
+ gegl_buffer_set (GEGL_BUFFER (self->buffer), rect, format, temp);
g_free (temp);
}
return TRUE;
Index: ChangeLog
===================================================================
--- ChangeLog (révision 1474)
+++ ChangeLog (copie de travail)
@@ -1,3 +1,8 @@
+2007-05-18 Étienne Bersac <[EMAIL PROTECTED]>
+
+ * operations/core/save-buffer.c: do not rely on input buffer to
+ get buffer dimension.
+
2007-05-18 Øyvind Kolås <[EMAIL PROTECTED]>
* gegl/buffer/gegl-buffer.h: removed inclusion of gegl-buffer-types.h,
_______________________________________________
Gegl-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer