Commit b9b3e876 authored by Øyvind Kolås's avatar Øyvind Kolås

Simplified buffer handling, by using rect parameter made available

in recent changes to buffer_set/get methods.
* operations/color/stretch-contrast.c: (process):
* operations/file-io/jpg-load.c: (gegl_buffer_import_jpg):
* operations/file-io/pixbuf.c: (process):
* operations/file-io/png-save.c: (gegl_buffer_export_png):
* operations/file-io/svg-load.c: (gegl_buffer_import_svg):
* operations/render/checkerboard.c: (process):
* operations/render/color.c: (process):
* operations/render/text.c: (process):
* operations/workshop/mandelbrot.c: (process):
parent b3e3e73d
2006-11-28 Øyvind Kolås <pippin@gimp.org>
Simplified buffer handling, by using rect parameter made available
in recent changes to buffer_set/get methods.
* operations/color/stretch-contrast.c: (process):
* operations/file-io/jpg-load.c: (gegl_buffer_import_jpg):
* operations/file-io/pixbuf.c: (process):
* operations/file-io/png-save.c: (gegl_buffer_export_png):
* operations/file-io/svg-load.c: (gegl_buffer_import_svg):
* operations/render/checkerboard.c: (process):
* operations/render/color.c: (process):
* operations/render/text.c: (process):
* operations/workshop/mandelbrot.c: (process):
2006-11-28 Øyvind Kolås <pippin@gimp.org>
Simplified buffer handling, by using rect parameter made available
......
......@@ -121,25 +121,14 @@ process (GeglOperation *operation)
for (row=0;row<result->h;row=consumed)
{
gint chunk = consumed+chunk_size<result->h?chunk_size:result->h-consumed;
GeglBuffer *in_line = g_object_new (GEGL_TYPE_BUFFER,
"source", input,
"x", result->x,
"y", result->y+row,
"width", result->w,
"height", chunk,
NULL);
GeglBuffer *out_line = g_object_new (GEGL_TYPE_BUFFER,
"source", output,
"x", result->x,
"y", result->y+row,
"width", result->w,
"height", chunk,
NULL);
gegl_buffer_get (in_line, NULL, buf, babl_format ("RGBA float"), 1.0);
GeglRect line = {result->x,
result->y+row,
result->w,
chunk};
gegl_buffer_get (input, &line, buf, babl_format ("RGBA float"), 1.0);
inner_process (min, max, buf, result->w * chunk);
gegl_buffer_set (out_line, NULL, buf, babl_format ("RGBA float"));
g_object_unref (in_line);
g_object_unref (out_line);
gegl_buffer_set (output, &line, buf, babl_format ("RGBA float"));
consumed+=chunk;
}
g_free (buf);
......
......@@ -200,17 +200,10 @@ gegl_buffer_import_jpg (GeglBuffer *gegl_buffer,
while (cinfo.output_scanline < cinfo.output_height)
{
GeglBuffer *rect = g_object_new (GEGL_TYPE_BUFFER,
"source", gegl_buffer,
"x", dest_x,
"y", dest_y + row++,
"width", cinfo.output_width,
"height", 1,
NULL);
GeglRect rect = {dest_x, dest_y + row++, cinfo.output_width, 1};
jpeg_read_scanlines (&cinfo, buffer, 1);
gegl_buffer_set (rect, NULL, buffer[0], babl_format ("R'G'B' u8"));
g_object_unref (rect);
gegl_buffer_set (gegl_buffer, &rect, buffer[0], babl_format ("R'G'B' u8"));
}
jpeg_destroy_decompress (&cinfo);
fclose (infile);
......
......@@ -46,8 +46,7 @@ process (GeglOperation *operation)
"width", gdk_pixbuf_get_width (self->pixbuf),
"height", gdk_pixbuf_get_height (self->pixbuf),
NULL);
gegl_buffer_set (op_source->output, NULL, gdk_pixbuf_get_pixels (self->pixbuf),
babl_format(gdk_pixbuf_get_has_alpha(self->pixbuf)?"R'G'B'A u8":"R'G'B' u8"));
gegl_buffer_set (op_source->output, NULL, gdk_pixbuf_get_pixels (self->pixbuf), NULL);
return TRUE;
}
......
......@@ -146,18 +146,10 @@ gegl_buffer_export_png (GeglBuffer *gegl_buffer,
for (i=0; i< height; i++)
{
GeglBuffer *rect = g_object_new (GEGL_TYPE_BUFFER,
"source", gegl_buffer,
"x", src_x,
"y", src_y + i,
"width", width,
"height", 1,
NULL);
gegl_buffer_get (rect, NULL, pixels, babl_format (format_string), 1.0);
GeglRect rect = {src_x, src_y+i, width, 1};
gegl_buffer_get (gegl_buffer, &rect, pixels, babl_format (format_string), 1.0);
png_write_rows (png, &pixels, 1);
g_object_unref (rect);
}
png_write_end (png, info);
......
......@@ -178,21 +178,11 @@ instead.
&pError);
if (pixbuf)
{
guchar *pixeldata;
GeglBuffer *rect;
guchar *pixeldata;
GeglRect rect = {dest_x, dest_y, width, height};
pixeldata = gdk_pixbuf_get_pixels (pixbuf);
rect = g_object_new (GEGL_TYPE_BUFFER,
"source", gegl_buffer,
"x", dest_x,
"y", dest_y,
"width", width,
"height", height,
NULL);
gegl_buffer_set (rect, NULL, pixeldata, babl_format ("R'G'B'A u8"));
g_object_unref (rect);
gegl_buffer_set (gegl_buffer, &rect, pixeldata, babl_format ("R'G'B'A u8"));
}
rsvg_term();
......
......@@ -92,7 +92,7 @@ process (GeglOperation *operation)
}
}
}
gegl_buffer_set (op_source->output, NULL, buf, babl_format ("RGBA float"));
gegl_buffer_set (op_source->output, NULL, buf, NULL);
g_free (buf);
}
return TRUE;
......
......@@ -67,7 +67,7 @@ process (GeglOperation *operation)
dst += 4;
}
}
gegl_buffer_set (op_source->output, NULL, buf, babl_format ("RGBA float"));
gegl_buffer_set (op_source->output, NULL, buf, NULL);
g_free (buf);
}
return TRUE;
......
......@@ -166,14 +166,7 @@ process (GeglOperation *operation)
cairo_translate (cr, -need->x, -need->y);
text_layout_text (self, cr, 0, NULL, NULL);
gegl_buffer_set (op_source->output, NULL, data,
babl_format_new (babl_model ("R'aG'aB'aA"),
babl_type ("u8"),
babl_component ("B'a"),
babl_component ("G'a"),
babl_component ("R'a"),
babl_component ("A"),
NULL));
gegl_buffer_set (op_source->output, NULL, data, NULL);
cairo_destroy (cr);
cairo_surface_destroy (surface);
......
......@@ -108,7 +108,7 @@ process (GeglOperation *operation)
}
}
}
gegl_buffer_set (op_source->output, NULL, buf, babl_format ("Y float"));
gegl_buffer_set (op_source->output, NULL, buf, NULL);
g_free (buf);
}
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment