[gegl] Test for gegl:over with OpenCL



commit e2db26aae349dfbe9abc66ef62228104c548d4d8
Author: Victor Oliveira <victormatheus gmail com>
Date:   Thu Feb 16 16:33:56 2012 -0200

    Test for gegl:over with OpenCL

 tests/opencl/Makefile.am    |    3 +-
 tests/opencl/test-cl-over.c |   69 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/tests/opencl/Makefile.am b/tests/opencl/Makefile.am
index fc67625..36f7f3b 100644
--- a/tests/opencl/Makefile.am
+++ b/tests/opencl/Makefile.am
@@ -6,7 +6,8 @@ TESTS_ENVIRONMENT = \
 
 # The tests
 noinst_PROGRAMS = \
-	test-cl-brightness-contrast
+	test-cl-brightness-contrast \
+	test-cl-over
 
 TESTS = $(noinst_PROGRAMS)
 
diff --git a/tests/opencl/test-cl-over.c b/tests/opencl/test-cl-over.c
new file mode 100644
index 0000000..74260fa
--- /dev/null
+++ b/tests/opencl/test-cl-over.c
@@ -0,0 +1,69 @@
+/* This file is part of GEGL.
+ *
+ * This library 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.
+ *
+ * This library 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 2011 Victor M. de Araujo Oliveira <victormatheus gmail com>
+ */
+
+#include <string.h>
+#include <assert.h>
+#include <babl/babl.h>
+#include <sys/time.h>
+
+#include "gegl.h"
+#include "gegl-types.h"
+#include "gegl-utils.h"
+#include "gegl-cl.h"
+
+#define SUCCESS 0
+#define FAILURE (-1)
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+  gint retval = SUCCESS;
+
+  char image_name_1 [1000];
+  char image_name_2 [1000];
+  
+  if (argc == 3)
+    {
+      strcpy(image_name_1, argv[1]);
+      strcpy(image_name_2, argv[2]);
+    }
+  else
+    return FAILURE;
+
+  gegl_init (&argc, &argv);
+
+  /* process */
+  {
+    GeglNode *gegl, *sink;
+
+    gegl = gegl_graph(sink = gegl_node ("gegl:png-save", "path", "out.png", NULL,
+                                        gegl_node ("gegl:over", NULL,
+                                                   gegl_node ("gegl:over", NULL,
+                                                              gegl_node ("gegl:load", "path", image_name_1, NULL),
+                                                              gegl_node ("gegl:load", "path", image_name_2, NULL)),
+                                                   gegl_node ("gegl:translate", "x", 200.0, "y", 200.0, NULL,
+                                                              gegl_node ("gegl:load", "path", image_name_2, NULL)))));
+    gegl_node_process (sink);
+    g_object_unref (gegl);
+  }
+
+  gegl_exit ();
+
+  return retval;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]