gegl r2274 - in trunk: . gegl/buffer
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2274 - in trunk: . gegl/buffer
- Date: Mon, 5 May 2008 22:49:18 +0100 (BST)
Author: ok
Date: Mon May 5 21:49:18 2008
New Revision: 2274
URL: http://svn.gnome.org/viewvc/gegl?rev=2274&view=rev
Log:
* gegl/buffer/gegl-buffer.h: added new method gegl_buffer_clear()
* gegl/buffer/gegl-buffer-access.c: (gegl_buffer_clear):
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-buffer-access.c
trunk/gegl/buffer/gegl-buffer.h
Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c (original)
+++ trunk/gegl/buffer/gegl-buffer-access.c Mon May 5 21:49:18 2008
@@ -1203,6 +1203,41 @@
g_free (temp);
}
+void
+gegl_buffer_clear (GeglBuffer *dst,
+ const GeglRectangle *dst_rect)
+{
+ /* FIXME: make gegl_buffer_copy work with COW shared tiles when possible */
+
+ GeglRectangle dst_line;
+ const Babl *format;
+ guchar *temp;
+ guint i;
+ gint pxsize;
+
+ g_return_if_fail (GEGL_IS_BUFFER (dst));
+
+ if (!dst_rect)
+ {
+ dst_rect = gegl_buffer_get_extent (dst);
+ }
+
+ pxsize = dst->tile_storage->px_size;
+ format = dst->format;
+
+ dst_line = *dst_rect;
+ dst_line.height = 1;
+
+ temp = g_malloc0 (dst_line.width * pxsize);
+
+ for (i=0; i<dst_rect->height; i++)
+ {
+ gegl_buffer_set (dst, &dst_line, format, temp, GEGL_AUTO_ROWSTRIDE);
+ dst_line.y++;
+ }
+ g_free (temp);
+}
+
GeglBuffer *
gegl_buffer_dup (GeglBuffer *buffer)
{
Modified: trunk/gegl/buffer/gegl-buffer.h
==============================================================================
--- trunk/gegl/buffer/gegl-buffer.h (original)
+++ trunk/gegl/buffer/gegl-buffer.h Mon May 5 21:49:18 2008
@@ -240,6 +240,18 @@
/**
+ * gegl_buffer_clear:
+ * @buffer: a #GeglBuffer
+ * @roi: a rectangular region
+ *
+ * Clears the provided rectangular region by setting all the associated memory
+ * to 0
+ */
+void gegl_buffer_clear (GeglBuffer *buffer,
+ const GeglRectangle *roi);
+
+
+/**
* gegl_buffer_copy:
* @src: source buffer.
* @src_rect: source rectangle (or NULL to copy entire source buffer)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]