gegl r2364 - in trunk: . gegl gegl/operation
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2364 - in trunk: . gegl gegl/operation
- Date: Sun, 1 Jun 2008 15:02:37 +0000 (UTC)
Author: ok
Date: Sun Jun 1 15:02:37 2008
New Revision: 2364
URL: http://svn.gnome.org/viewvc/gegl?rev=2364&view=rev
Log:
Add point-render operation that does as few as possible copies when
rendering potentially based on x,y coordinates in buffer.
* gegl/operation/gegl-operation-point-render.c: new file.
* gegl/operation/gegl-operation-point-render.h: new file.
* gegl/gegl-plugin.h:
* gegl/gegl-chant.h: made available to plug-ins.
* gegl/operation/Makefile.am: added new files.
Added:
trunk/gegl/operation/gegl-operation-point-render.c
trunk/gegl/operation/gegl-operation-point-render.h
Modified:
trunk/ChangeLog
trunk/gegl/gegl-chant.h
trunk/gegl/gegl-plugin.h
trunk/gegl/operation/Makefile.am
Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h (original)
+++ trunk/gegl/gegl-chant.h Sun Jun 1 15:02:37 2008
@@ -205,6 +205,38 @@
#endif
+
+#ifdef GEGL_CHANT_TYPE_POINT_RENDER
+struct _GeglChant
+{
+ GeglOperationPointRender parent_instance;
+ gpointer properties;
+};
+
+typedef struct
+{
+ GeglOperationPointRenderClass parent_class;
+} GeglChantClass;
+
+GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_RENDER);
+
+#endif
+
+
+#ifdef GEGL_CHANT_TYPE_TEMPORAL_FILTER
+struct _GeglChant
+{
+ GeglOperationTemporalFilter parent_instance;
+ gpointer properties;
+};
+
+typedef struct
+{
+ GeglOperationTemporalFilterClass parent_class;
+} GeglChantClass;
+GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_TEMPORAL_FILTER);
+#endif
+
#ifdef GEGL_CHANT_TYPE_AREA_FILTER
struct _GeglChant
{
Modified: trunk/gegl/gegl-plugin.h
==============================================================================
--- trunk/gegl/gegl-plugin.h (original)
+++ trunk/gegl/gegl-plugin.h Sun Jun 1 15:02:37 2008
@@ -146,10 +146,10 @@
#include <operation/gegl-operation-point-filter.h>
#include <operation/gegl-operation-composer.h>
#include <operation/gegl-operation-point-composer.h>
+#include <operation/gegl-operation-point-render.h>
#include <operation/gegl-operation-source.h>
#include <operation/gegl-operation-sink.h>
#include <operation/gegl-operation-meta.h>
-#include <operation/gegl-operation-temporal-filter.h>
#else
Modified: trunk/gegl/operation/Makefile.am
==============================================================================
--- trunk/gegl/operation/Makefile.am (original)
+++ trunk/gegl/operation/Makefile.am Sun Jun 1 15:02:37 2008
@@ -1,31 +1,33 @@
noinst_LTLIBRARIES = liboperation.la
OPERATION_sources = \
- gegl-extension-handler.c \
- gegl-operation.c \
- gegl-operation-area-filter.c \
- gegl-operation-composer.c \
- gegl-operation-filter.c \
- gegl-operation-meta.c \
- gegl-operation-point-composer.c \
- gegl-operation-point-filter.c \
- gegl-operation-sink.c \
- gegl-operation-source.c \
- gegl-operation-processors.c \
+ gegl-extension-handler.c \
+ gegl-operation.c \
+ gegl-operation-area-filter.c \
+ gegl-operation-composer.c \
+ gegl-operation-filter.c \
+ gegl-operation-meta.c \
+ gegl-operation-point-composer.c \
+ gegl-operation-point-filter.c \
+ gegl-operation-point-render.c \
+ gegl-operation-sink.c \
+ gegl-operation-source.c \
+ gegl-operation-processors.c \
gegl-operations.c
OPERATION_headers = \
- gegl-extension-handler.h \
- gegl-operation.h \
- gegl-operation-composer.h \
- gegl-operation-area-filter.h \
- gegl-operation-filter.h \
- gegl-operation-meta.h \
- gegl-operation-point-composer.h \
- gegl-operation-point-filter.h \
- gegl-operation-sink.h \
- gegl-operation-source.h \
+ gegl-extension-handler.h \
+ gegl-operation.h \
+ gegl-operation-composer.h \
+ gegl-operation-area-filter.h \
+ gegl-operation-filter.h \
+ gegl-operation-meta.h \
+ gegl-operation-point-composer.h \
+ gegl-operation-point-filter.h \
+ gegl-operation-point-render.h \
+ gegl-operation-sink.h \
+ gegl-operation-source.h \
gegl-operations.h
public_headers = \
Added: trunk/gegl/operation/gegl-operation-point-render.c
==============================================================================
--- (empty file)
+++ trunk/gegl/operation/gegl-operation-point-render.c Sun Jun 1 15:02:37 2008
@@ -0,0 +1,113 @@
+/* This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006 Ãyvind KolÃs
+ */
+
+
+#define GEGL_INTERNAL
+#include "config.h"
+
+#include <glib-object.h>
+#include "gegl-types.h"
+#include "gegl-operation-point-render.h"
+#include "graph/gegl-pad.h"
+#include "graph/gegl-node.h"
+#include "gegl-utils.h"
+#include <string.h>
+
+#include "gegl-buffer-private.h"
+#include "gegl-tile-storage.h"
+
+static gboolean process_inner (GeglOperation *operation,
+ GeglBuffer *output,
+ const GeglRectangle *result);
+
+G_DEFINE_TYPE (GeglOperationPointRender, gegl_operation_point_render, GEGL_TYPE_OPERATION_SOURCE)
+
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
+static void
+gegl_operation_point_render_class_init (GeglOperationPointRenderClass *klass)
+{
+ GeglOperationSourceClass *source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
+ GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
+
+ source_class->process = process_inner;
+ operation_class->prepare = prepare;
+}
+
+static void
+gegl_operation_point_render_init (GeglOperationPointRender *self)
+{
+}
+
+
+static gboolean
+process_inner (GeglOperation *operation,
+ GeglBuffer *output,
+ const GeglRectangle *result)
+{
+ GeglPad *pad;
+ const Babl *out_format;
+ GeglOperationPointRenderClass *point_render_class;
+
+ point_render_class = GEGL_OPERATION_POINT_RENDER_GET_CLASS (operation);
+
+ pad = gegl_node_get_pad (operation->node, "output");
+ out_format = gegl_pad_get_format (pad);
+ if (!out_format)
+ {
+ g_warning ("%s", gegl_node_get_debug_name (operation->node));
+ }
+ g_assert (out_format);
+
+ if ((result->width > 0) && (result->height > 0))
+ {
+ gint output_bpp = output->format->format.bytes_per_pixel;
+ gpointer *out_buf = NULL;
+ Babl *outfish;
+
+ GeglBufferScanIterator write;
+ gegl_buffer_scan_iterator_init (&write, output, *result, TRUE);
+
+ outfish = babl_fish (out_format, output->format);
+
+ gegl_buffer_lock (output);
+
+ out_buf = gegl_malloc (output_bpp * write.max_size);
+ while (gegl_buffer_scan_iterator_next (&write))
+ {
+ GeglRectangle roi;
+ gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
+
+ point_render_class->process (operation, out_buf, write.length, &roi);
+
+ /* this is the actual write happening directly to the underlying
+ * scan on the tile.
+ */
+ babl_process (outfish, out_buf, write.data, write.length);
+ }
+
+ if (out_buf)
+ gegl_free (out_buf);
+ gegl_buffer_unlock (output);
+ }
+ return TRUE;
+}
Added: trunk/gegl/operation/gegl-operation-point-render.h
==============================================================================
--- (empty file)
+++ trunk/gegl/operation/gegl-operation-point-render.h Sun Jun 1 15:02:37 2008
@@ -0,0 +1,54 @@
+/* This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006 Ãyvind KolÃs
+ */
+
+#ifndef __GEGL_OPERATION_POINT_RENDER_H__
+#define __GEGL_OPERATION_POINT_RENDER_H__
+
+#include "gegl-operation-source.h"
+
+G_BEGIN_DECLS
+
+#define GEGL_TYPE_OPERATION_POINT_RENDER (gegl_operation_point_render_get_type ())
+#define GEGL_OPERATION_POINT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_POINT_RENDER, GeglOperationPointRender))
+#define GEGL_OPERATION_POINT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_POINT_RENDER, GeglOperationPointRenderClass))
+#define GEGL_IS_OPERATION_POINT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_POINT_RENDER))
+#define GEGL_IS_OPERATION_POINT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_POINT_RENDER))
+#define GEGL_OPERATION_POINT_RENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_POINT_RENDER, GeglOperationPointRenderClass))
+
+typedef struct _GeglOperationPointRender GeglOperationPointRender;
+struct _GeglOperationPointRender
+{
+ GeglOperationSource parent_instance;
+};
+
+typedef struct _GeglOperationPointRenderClass GeglOperationPointRenderClass;
+struct _GeglOperationPointRenderClass
+{
+ GeglOperationSourceClass parent_class;
+
+ gboolean (* process) (GeglOperation *self, /* for parameters */
+ void *out_buf, /* output buffer */
+ glong samples, /* number of samples */
+ GeglRectangle *roi); /* can be used if position is of importance*/
+};
+
+GType gegl_operation_point_render_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]