[Gegl-developer] whoops

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

 



I forgot to actually ATTACH the diff.

Here ya go:
diff --recursive -u -p -P gegl/gegl/Makefile.am gegl-new/gegl/Makefile.am
--- gegl/gegl/Makefile.am	2003-02-11 17:39:10.000000000 -0800
+++ gegl-new/gegl/Makefile.am	2003-02-21 14:25:00.000000000 -0800
@@ -22,6 +22,7 @@ GEGL_SRC = \
   gegl-comp.c \
   gegl-component-color-model.c \
   gegl-component-storage.c \
+  gegl-copy.c \
   gegl-darken.c \
   gegl-data.c \
   gegl-dfs-visitor.c \
diff --recursive -u -p -P gegl/gegl/gegl-copy.c gegl-new/gegl/gegl-copy.c
--- gegl/gegl/gegl-copy.c	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/gegl/gegl-copy.c	2003-02-21 15:17:58.000000000 -0800
@@ -0,0 +1,159 @@
+/* File: gegl-copy.c
+ * Author: Daniel S. Rogers
+ * Date: 21 February, 2003
+ *Derived from gegl-fade.c
+ */
+#include "gegl-copy.h"
+#include "gegl-scanline-processor.h"
+#include "gegl-image-iterator.h"
+#include "gegl-scalar-data.h"
+#include "gegl-value-types.h"
+#include "gegl-param-specs.h"
+#include "gegl-utils.h"
+
+/* for memcpy */
+#include "string.h"
+
+static void class_init (GeglCopyClass * klass);
+
+static GeglScanlineFunc get_scanline_func(GeglUnary * unary, GeglColorSpaceType space, GeglChannelSpaceType type);
+
+static void copy_general (GeglFilter * filter, GeglImageIterator ** iters, gint byte_width);
+inline static void copy_float   (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+inline static void copy_uint8   (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+inline static void copy_uint16  (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+
+static gpointer parent_class = NULL;
+
+GType
+gegl_copy_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+        sizeof (GeglCopyClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) class_init,
+        (GClassFinalizeFunc) NULL,
+        NULL,
+        sizeof (GeglCopy),
+        0,
+        (GInstanceInitFunc) NULL,
+      };
+
+      type = g_type_register_static (GEGL_TYPE_UNARY, 
+                                     "GeglCopy", 
+                                     &typeInfo, 
+                                     0);
+    }
+    return type;
+}
+
+static void 
+class_init (GeglCopyClass * klass)
+{
+  //GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+  //GeglOpClass *op_class = GEGL_OP_CLASS(klass);
+  GeglUnaryClass *unary_class = GEGL_UNARY_CLASS(klass);
+
+  parent_class = g_type_class_peek_parent(klass);
+
+  unary_class->get_scanline_func = get_scanline_func;
+
+}
+
+/* scanline_funcs[data type] */
+static GeglScanlineFunc scanline_funcs[] = 
+{ 
+  NULL, 
+  copy_uint8, 
+  copy_float, 
+  copy_uint16 
+};
+
+static GeglScanlineFunc
+get_scanline_func(GeglUnary * unary,
+                  GeglColorSpaceType space,
+                  GeglChannelSpaceType type)
+{
+  return scanline_funcs[type];
+}
+
+static void
+copy_general (GeglFilter * filter,
+	      GeglImageIterator ** iters,
+	      gint byte_width)
+{
+  gpointer * d = gegl_image_iterator_color_channels(iters[0]);
+  gpointer da = gegl_image_iterator_alpha_channel(iters[0]);
+  gint d_color_chans = gegl_image_iterator_get_num_colors(iters[0]);
+
+  gpointer * a = gegl_image_iterator_color_channels(iters[1]);
+  gpointer aa = gegl_image_iterator_alpha_channel(iters[1]);
+  gint a_color_chans = gegl_image_iterator_get_num_colors(iters[1]);
+
+  gint alpha_mask = 0x0;
+
+  if(aa)
+    alpha_mask |= GEGL_A_ALPHA; 
+
+  {
+    gpointer d0 = (d_color_chans > 0) ? d[0]: NULL;   
+    gpointer d1 = (d_color_chans > 1) ? d[1]: NULL;
+    gpointer d2 = (d_color_chans > 2) ? d[2]: NULL;
+
+    gpointer a0 = (a_color_chans > 0) ? a[0]: NULL;   
+    gpointer a1 = (a_color_chans > 1) ? a[1]: NULL;
+    gpointer a2 = (a_color_chans > 2) ? a[2]: NULL;
+    
+
+    /* I am not sure if it is save to assume here that op a has as
+       many color channels as the destination.  I will check that
+       before adding special cases.
+    */
+     
+    switch(d_color_chans)
+      {
+          case 3: memcpy(d2,a2,byte_width);
+          case 2: memcpy(d1,a1,byte_width);
+          case 1: memcpy(d0,a0,byte_width);
+          case 0: 
+      }
+
+    if(alpha_mask == GEGL_A_ALPHA)
+      {
+	  memcpy(da,aa,byte_width);
+      }
+  }
+
+  g_free(d);
+  g_free(a);
+}
+
+inline static void
+copy_float (GeglFilter * filter,
+	    GeglImageIterator ** iters,
+	    gint width)
+{
+  copy_general(filter,iters,width * sizeof(gfloat));
+}
+
+inline static void
+copy_uint8 (GeglFilter * filter,
+	    GeglImageIterator ** iters,
+	    gint width)
+{
+  copy_general(filter,iters,width * sizeof(guint8));
+}
+
+inline static void
+copy_uint16 (GeglFilter * filter,
+	     GeglImageIterator ** iters,
+	     gint width)
+{
+  copy_general(filter,iters,width * sizeof(guint16));
+}
diff --recursive -u -p -P gegl/gegl/gegl-copy.c~ gegl-new/gegl/gegl-copy.c~
--- gegl/gegl/gegl-copy.c~	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/gegl/gegl-copy.c~	2003-02-21 14:21:23.000000000 -0800
@@ -0,0 +1,154 @@
+#include "gegl-copy.h"
+#include "gegl-scanline-processor.h"
+#include "gegl-image-iterator.h"
+#include "gegl-scalar-data.h"
+#include "gegl-value-types.h"
+#include "gegl-param-specs.h"
+#include "gegl-utils.h"
+
+/* for memcpy */
+#include "string.h"
+
+static void class_init (GeglCopyClass * klass);
+
+static GeglScanlineFunc get_scanline_func(GeglUnary * unary, GeglColorSpaceType space, GeglChannelSpaceType type);
+
+static void copy_general (GeglFilter * filter, GeglImageIterator ** iters, gint byte_width);
+inline static void copy_float   (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+inline static void copy_uint8   (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+inline static void copy_uint16  (GeglFilter * filter, GeglImageIterator ** iters, gint width);
+
+static gpointer parent_class = NULL;
+
+GType
+gegl_copy_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+        sizeof (GeglCopyClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) class_init,
+        (GClassFinalizeFunc) NULL,
+        NULL,
+        sizeof (GeglCopy),
+        0,
+        (GInstanceInitFunc) NULL,
+      };
+
+      type = g_type_register_static (GEGL_TYPE_UNARY, 
+                                     "GeglCopy", 
+                                     &typeInfo, 
+                                     0);
+    }
+    return type;
+}
+
+static void 
+class_init (GeglCopyClass * klass)
+{
+  //GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+  //GeglOpClass *op_class = GEGL_OP_CLASS(klass);
+  GeglUnaryClass *unary_class = GEGL_UNARY_CLASS(klass);
+
+  parent_class = g_type_class_peek_parent(klass);
+
+  unary_class->get_scanline_func = get_scanline_func;
+
+}
+
+/* scanline_funcs[data type] */
+static GeglScanlineFunc scanline_funcs[] = 
+{ 
+  NULL, 
+  copy_uint8, 
+  copy_float, 
+  copy_uint16 
+};
+
+static GeglScanlineFunc
+get_scanline_func(GeglUnary * unary,
+                  GeglColorSpaceType space,
+                  GeglChannelSpaceType type)
+{
+  return scanline_funcs[type];
+}
+
+static void
+copy_general (GeglFilter * filter,
+	      GeglImageIterator ** iters,
+	      gint byte_width)
+{
+  gpointer * d = gegl_image_iterator_color_channels(iters[0]);
+  gpointer da = gegl_image_iterator_alpha_channel(iters[0]);
+  gint d_color_chans = gegl_image_iterator_get_num_colors(iters[0]);
+
+  gpointer * a = gegl_image_iterator_color_channels(iters[1]);
+  gpointer aa = gegl_image_iterator_alpha_channel(iters[1]);
+  gint a_color_chans = gegl_image_iterator_get_num_colors(iters[1]);
+
+  gint alpha_mask = 0x0;
+
+  if(aa)
+    alpha_mask |= GEGL_A_ALPHA; 
+
+  {
+    gpointer d0 = (d_color_chans > 0) ? d[0]: NULL;   
+    gpointer d1 = (d_color_chans > 1) ? d[1]: NULL;
+    gpointer d2 = (d_color_chans > 2) ? d[2]: NULL;
+
+    gpointer a0 = (a_color_chans > 0) ? a[0]: NULL;   
+    gpointer a1 = (a_color_chans > 1) ? a[1]: NULL;
+    gpointer a2 = (a_color_chans > 2) ? a[2]: NULL;
+    
+
+    /* I am not sure if it is save to assume here that op a has as
+       many color channels as the destination.  I will check that
+       before adding special cases.
+    */
+     
+    switch(d_color_chans)
+      {
+          case 3: memcpy(d2,a2,byte_width);
+          case 2: memcpy(d1,a1,byte_width);
+          case 1: memcpy(d0,a0,byte_width);
+          case 0: 
+      }
+
+    if(alpha_mask == GEGL_A_ALPHA)
+      {
+	  memcpy(da,aa,byte_width);
+      }
+  }
+
+  g_free(d);
+  g_free(a);
+}
+
+inline static void
+copy_float (GeglFilter * filter,
+	    GeglImageIterator ** iters,
+	    gint width)
+{
+  copy_general(filter,iters,width * sizeof(gfloat));
+}
+
+inline static void
+copy_uint8 (GeglFilter * filter,
+	    GeglImageIterator ** iters,
+	    gint width)
+{
+  copy_general(filter,iters,width * sizeof(guint8));
+}
+
+inline static void
+copy_uint16 (GeglFilter * filter,
+	     GeglImageIterator ** iters,
+	     gint width)
+{
+  copy_general(filter,iters,width * sizeof(guint16));
+}
diff --recursive -u -p -P gegl/gegl/gegl-copy.h gegl-new/gegl/gegl-copy.h
--- gegl/gegl/gegl-copy.h	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/gegl/gegl-copy.h	2003-02-21 15:18:17.000000000 -0800
@@ -0,0 +1,42 @@
+#ifndef __GEGL_COPY_H__
+#define __GEGL_COPY_H__
+
+/* File: gegl-copy.h
+ * Author: Daniel S. Rogers
+ * Date: 21 February, 2003
+ *Derived from gegl-fade.h
+ */
+#include "gegl-unary.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GEGL_TYPE_COPY               (gegl_copy_get_type ())
+#define GEGL_COPY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_COPY, GeglCopy))
+#define GEGL_COPY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_COPY, GeglCopyClass))
+#define GEGL_IS_COPY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_COPY))
+#define GEGL_IS_COPY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_COPY))
+#define GEGL_COPY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_COPY, GeglCopyClass))
+
+typedef struct _GeglCopy GeglCopy;
+struct _GeglCopy 
+{
+   GeglUnary unary;
+
+};
+
+typedef struct _GeglCopyClass GeglCopyClass;
+struct _GeglCopyClass 
+{
+   GeglUnaryClass unary_class;
+};
+
+GType            gegl_copy_get_type         (void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --recursive -u -p -P gegl/gegl/gegl-copy.h~ gegl-new/gegl/gegl-copy.h~
--- gegl/gegl/gegl-copy.h~	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/gegl/gegl-copy.h~	2003-02-21 14:08:56.000000000 -0800
@@ -0,0 +1,37 @@
+#ifndef __GEGL_COPY_H__
+#define __GEGL_COPY_H__
+
+#include "gegl-unary.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GEGL_TYPE_COPY               (gegl_copy_get_type ())
+#define GEGL_COPY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_COPY, GeglCopy))
+#define GEGL_COPY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_COPY, GeglCopyClass))
+#define GEGL_IS_COPY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_COPY))
+#define GEGL_IS_COPY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_COPY))
+#define GEGL_COPY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_COPY, GeglCopyClass))
+
+typedef struct _GeglCopy GeglCopy;
+struct _GeglCopy 
+{
+   GeglUnary unary;
+
+};
+
+typedef struct _GeglCopyClass GeglCopyClass;
+struct _GeglCopyClass 
+{
+   GeglUnaryClass unary_class;
+};
+
+GType            gegl_copy_get_type         (void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --recursive -u -p -P gegl/gegl/gegl.h gegl-new/gegl/gegl.h
--- gegl/gegl/gegl.h	2003-02-11 17:39:11.000000000 -0800
+++ gegl-new/gegl/gegl.h	2003-02-21 14:30:42.000000000 -0800
@@ -15,6 +15,7 @@
 #include <gegl-comp.h>
 #include <gegl-component-storage.h>
 #include <gegl-component-color-model.h>
+#include <gegl-copy.h>
 #include <gegl-darken.h>
 #include <gegl-data.h>
 #include <gegl-buffer.h>
diff --recursive -u -p -P gegl/tests/Makefile.am gegl-new/tests/Makefile.am
--- gegl/tests/Makefile.am	2003-02-11 17:39:15.000000000 -0800
+++ gegl-new/tests/Makefile.am	2003-02-21 14:46:54.000000000 -0800
@@ -55,6 +55,8 @@ testgegl_SOURCES = \
    colorspacetest.c \
    colortest-rgb-float.c \
    colortest-rgb-uint8.c \
+   copytest-rgb-float.c \
+   copytest-rgb-uint8.c \
    dfsvisitortest.c \
    dumpvisitortest.c \
    fadetest-rgb-float.c \
diff --recursive -u -p -P gegl/tests/copytest-rgb-float.c gegl-new/tests/copytest-rgb-float.c
--- gegl/tests/copytest-rgb-float.c	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/tests/copytest-rgb-float.c	2003-02-21 15:19:56.000000000 -0800
@@ -0,0 +1,136 @@
+/* File: copytest-rbg-float.c
+ * Author: Daniel S. Rogers
+ * Date: 21 February, 2003
+ *Derived from fadetest-rbg-float.c
+ */
+
+#include <glib-object.h>
+#include "gegl.h"
+#include "ctest.h"
+#include "csuite.h"
+#include "testutils.h"
+#include <string.h>
+
+#define IMAGE_OP_WIDTH 1 
+#define IMAGE_OP_HEIGHT 1 
+
+static GeglOp * source;
+
+static void
+test_copy_g_object_new(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    ct_test(test, copy != NULL);
+    ct_test(test, GEGL_IS_COPY(copy));
+    ct_test(test, g_type_parent(GEGL_TYPE_COPY) == GEGL_TYPE_UNARY);
+    ct_test(test, !strcmp("GeglCopy", g_type_name(GEGL_TYPE_COPY)));
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_g_object_properties(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, 
+                                    "input", 0, source,
+                                     NULL);  
+
+    ct_test(test, 1 == gegl_node_get_num_inputs(GEGL_NODE(copy)));
+    ct_test(test, source == (GeglOp*)gegl_node_get_source(GEGL_NODE(copy), 0));
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    g_object_set(copy, NULL);
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, 
+                                    NULL);  
+
+    g_object_get(copy, NULL);
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_apply(Test *test)
+{
+  {
+    GeglOp *copy = g_object_new(GEGL_TYPE_COPY,
+                                "input", 0, source,
+                                NULL);
+
+    gegl_op_apply(copy); 
+
+    ct_test(test, testutils_check_pixel_rgb_float(GEGL_IMAGE_OP(copy), 
+                                            .1, 
+                                            .2, 
+                                            .3));  
+    g_object_unref(copy);
+  }
+
+  {
+    GeglOp *copy1 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, source,
+                                 NULL);
+
+    GeglOp *copy2 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, copy1,
+                                 NULL);
+
+    gegl_op_apply(copy2); 
+
+    ct_test(test, testutils_check_pixel_rgb_float(GEGL_IMAGE_OP(copy2), 
+                                            .1, 
+                                            .2, 
+                                            .3));  
+
+    g_object_unref(copy1);
+    g_object_unref(copy2);
+  }
+}
+
+static void
+copy_test_setup(Test *test)
+{
+  source = g_object_new(GEGL_TYPE_COLOR, 
+                        "width", IMAGE_OP_WIDTH, 
+                        "height", IMAGE_OP_HEIGHT, 
+                        "pixel-rgb-float",.1, .2, .3, 
+                        NULL); 
+
+}
+
+static void
+copy_test_teardown(Test *test)
+{
+  g_object_unref(source);
+}
+
+Test *
+create_copy_test_rgb_float()
+{
+  Test* t = ct_create("GeglCopyTestRgbFloat");
+
+  g_assert(ct_addSetUp(t, copy_test_setup));
+  g_assert(ct_addTearDown(t, copy_test_teardown));
+
+#if 1 
+  g_assert(ct_addTestFun(t, test_copy_g_object_new));
+  g_assert(ct_addTestFun(t, test_copy_g_object_properties));
+  g_assert(ct_addTestFun(t, test_copy_apply));
+#endif
+
+  return t; 
+}
diff --recursive -u -p -P gegl/tests/copytest-rgb-float.c~ gegl-new/tests/copytest-rgb-float.c~
--- gegl/tests/copytest-rgb-float.c~	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/tests/copytest-rgb-float.c~	2003-02-21 14:51:53.000000000 -0800
@@ -0,0 +1,130 @@
+#include <glib-object.h>
+#include "gegl.h"
+#include "ctest.h"
+#include "csuite.h"
+#include "testutils.h"
+#include <string.h>
+
+#define IMAGE_OP_WIDTH 1 
+#define IMAGE_OP_HEIGHT 1 
+
+static GeglOp * source;
+
+static void
+test_copy_g_object_new(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    ct_test(test, copy != NULL);
+    ct_test(test, GEGL_IS_COPY(copy));
+    ct_test(test, g_type_parent(GEGL_TYPE_COPY) == GEGL_TYPE_UNARY);
+    ct_test(test, !strcmp("GeglCopy", g_type_name(GEGL_TYPE_COPY)));
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_g_object_properties(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, 
+                                    "input", 0, source,
+                                     NULL);  
+
+    ct_test(test, 1 == gegl_node_get_num_inputs(GEGL_NODE(copy)));
+    ct_test(test, source == (GeglOp*)gegl_node_get_source(GEGL_NODE(copy), 0));
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    g_object_set(copy, NULL);
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, 
+                                    NULL);  
+
+    g_object_get(copy, NULL);
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_apply(Test *test)
+{
+  {
+    GeglOp *copy = g_object_new(GEGL_TYPE_COPY,
+                                "input", 0, source,
+                                NULL);
+
+    gegl_op_apply(copy); 
+
+    ct_test(test, testutils_check_pixel_rgb_float(GEGL_IMAGE_OP(copy), 
+                                            .1, 
+                                            .2, 
+                                            .3));  
+    g_object_unref(copy);
+  }
+
+  {
+    GeglOp *copy1 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, source,
+                                 NULL);
+
+    GeglOp *copy2 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, copy1,
+                                 NULL);
+
+    gegl_op_apply(copy2); 
+
+    ct_test(test, testutils_check_pixel_rgb_float(GEGL_IMAGE_OP(copy2), 
+                                            .1, 
+                                            .2, 
+                                            .3));  
+
+    g_object_unref(copy1);
+    g_object_unref(copy2);
+  }
+}
+
+static void
+copy_test_setup(Test *test)
+{
+  source = g_object_new(GEGL_TYPE_COLOR, 
+                        "width", IMAGE_OP_WIDTH, 
+                        "height", IMAGE_OP_HEIGHT, 
+                        "pixel-rgb-float",.1, .2, .3, 
+                        NULL); 
+
+}
+
+static void
+copy_test_teardown(Test *test)
+{
+  g_object_unref(source);
+}
+
+Test *
+create_copy_test_rgb_float()
+{
+  Test* t = ct_create("GeglCopyTestRgbFloat");
+
+  g_assert(ct_addSetUp(t, copy_test_setup));
+  g_assert(ct_addTearDown(t, copy_test_teardown));
+
+#if 1 
+  g_assert(ct_addTestFun(t, test_copy_g_object_new));
+  g_assert(ct_addTestFun(t, test_copy_g_object_properties));
+  g_assert(ct_addTestFun(t, test_copy_apply));
+#endif
+
+  return t; 
+}
diff --recursive -u -p -P gegl/tests/copytest-rgb-uint8.c gegl-new/tests/copytest-rgb-uint8.c
--- gegl/tests/copytest-rgb-uint8.c	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/tests/copytest-rgb-uint8.c	2003-02-21 15:19:48.000000000 -0800
@@ -0,0 +1,145 @@
+/* File: copytest-rgb-uint8.c
+ * Author: Daniel S. Rogers
+ * Date: 21 February, 2003
+ *Derived from copytest-fade-rgb-uint8.c
+ */
+#include <glib-object.h>
+#include "gegl.h"
+#include "ctest.h"
+#include "csuite.h"
+#include "testutils.h"
+#include <string.h>
+
+
+#define R0 80
+#define G0 160
+#define B0 240
+
+#define IMAGE_OP_WIDTH 1 
+#define IMAGE_OP_HEIGHT 1 
+
+static GeglOp * source;
+
+static void
+test_copy_g_object_new(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    ct_test(test, copy != NULL);
+    ct_test(test, GEGL_IS_COPY(copy));
+    ct_test(test, g_type_parent(GEGL_TYPE_COPY) == GEGL_TYPE_UNARY);
+    ct_test(test, !strcmp("GeglCopy", g_type_name(GEGL_TYPE_COPY)));
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_g_object_properties(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY,  
+                                    "input", 0, source,
+                                     NULL);  
+
+    ct_test(test, 1 == gegl_node_get_num_inputs(GEGL_NODE(copy)));
+    ct_test(test, source == (GeglOp*)gegl_node_get_source(GEGL_NODE(copy), 0));
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY,  
+                                    NULL);  
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_apply(Test *test)
+{
+  {
+    guint8 r, g, b;
+    GeglOp *copy = g_object_new(GEGL_TYPE_COPY,
+                                "input", 0, source,
+                                NULL);
+
+    gegl_op_apply(copy); 
+
+   
+    r = CLAMP((gint)(R0 + .5), 0, 255); 
+    g = CLAMP((gint)(G0 + .5), 0, 255); 
+    b = CLAMP((gint)(B0 + .5), 0, 255); 
+
+    ct_test(test, testutils_check_rgb_uint8(GEGL_IMAGE_OP(copy), r, g, b)); 
+    g_object_unref(copy);
+  }
+
+  {
+    guint8 r, g, b;
+    GeglOp *copy1 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, source,
+                                 NULL);
+
+    GeglOp *copy2 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, copy1,
+                                 NULL);
+
+    gegl_op_apply(copy2); 
+
+    r = CLAMP((gint)(R0 + .5), 0, 255); 
+    g = CLAMP((gint)(G0 + .5), 0, 255); 
+    b = CLAMP((gint)(B0 + .5), 0, 255); 
+
+    r = CLAMP((gint)(r + .5), 0, 255); 
+    g = CLAMP((gint)(g + .5), 0, 255); 
+    b = CLAMP((gint)(b + .5), 0, 255); 
+
+    ct_test(test, testutils_check_rgb_uint8(GEGL_IMAGE_OP(copy2), r, g, b)); 
+
+    g_object_unref(copy1);
+    g_object_unref(copy2);
+  }
+}
+
+static void
+copy_test_setup(Test *test)
+{
+  source = g_object_new(GEGL_TYPE_COLOR, 
+                        "width", IMAGE_OP_WIDTH, 
+                        "height", IMAGE_OP_HEIGHT, 
+                        "pixel-rgb-uint8", R0, G0, B0, 
+                        NULL); 
+
+}
+
+static void
+copy_test_teardown(Test *test)
+{
+  g_object_unref(source);
+}
+
+Test *
+create_copy_test_rgb_uint8()
+{
+  Test* t = ct_create("GeglCopyTestRgbUint8");
+
+  g_assert(ct_addSetUp(t, copy_test_setup));
+  g_assert(ct_addTearDown(t, copy_test_teardown));
+
+#if 1 
+  g_assert(ct_addTestFun(t, test_copy_g_object_new));
+  g_assert(ct_addTestFun(t, test_copy_g_object_properties));
+  g_assert(ct_addTestFun(t, test_copy_apply));
+#endif
+
+  return t; 
+}
diff --recursive -u -p -P gegl/tests/copytest-rgb-uint8.c~ gegl-new/tests/copytest-rgb-uint8.c~
--- gegl/tests/copytest-rgb-uint8.c~	1969-12-31 16:00:00.000000000 -0800
+++ gegl-new/tests/copytest-rgb-uint8.c~	2003-02-21 14:52:38.000000000 -0800
@@ -0,0 +1,140 @@
+#include <glib-object.h>
+#include "gegl.h"
+#include "ctest.h"
+#include "csuite.h"
+#include "testutils.h"
+#include <string.h>
+
+
+#define R0 80
+#define G0 160
+#define B0 240
+
+#define IMAGE_OP_WIDTH 1 
+#define IMAGE_OP_HEIGHT 1 
+
+static GeglOp * source;
+
+static void
+test_copy_g_object_new(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    ct_test(test, copy != NULL);
+    ct_test(test, GEGL_IS_COPY(copy));
+    ct_test(test, g_type_parent(GEGL_TYPE_COPY) == GEGL_TYPE_UNARY);
+    ct_test(test, !strcmp("GeglCopy", g_type_name(GEGL_TYPE_COPY)));
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_g_object_properties(Test *test)
+{
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY,  
+                                    "input", 0, source,
+                                     NULL);  
+
+    ct_test(test, 1 == gegl_node_get_num_inputs(GEGL_NODE(copy)));
+    ct_test(test, source == (GeglOp*)gegl_node_get_source(GEGL_NODE(copy), 0));
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY, NULL);  
+
+    g_object_unref(copy);
+  }
+
+  {
+    GeglCopy * copy = g_object_new (GEGL_TYPE_COPY,  
+                                    NULL);  
+
+    g_object_unref(copy);
+  }
+}
+
+static void
+test_copy_apply(Test *test)
+{
+  {
+    guint8 r, g, b;
+    GeglOp *copy = g_object_new(GEGL_TYPE_COPY,
+                                "input", 0, source,
+                                NULL);
+
+    gegl_op_apply(copy); 
+
+   
+    r = CLAMP((gint)(R0 + .5), 0, 255); 
+    g = CLAMP((gint)(G0 + .5), 0, 255); 
+    b = CLAMP((gint)(B0 + .5), 0, 255); 
+
+    ct_test(test, testutils_check_rgb_uint8(GEGL_IMAGE_OP(copy), r, g, b)); 
+    g_object_unref(copy);
+  }
+
+  {
+    guint8 r, g, b;
+    GeglOp *copy1 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, source,
+                                 NULL);
+
+    GeglOp *copy2 = g_object_new(GEGL_TYPE_COPY,
+                                 "input", 0, copy1,
+                                 NULL);
+
+    gegl_op_apply(copy2); 
+
+    r = CLAMP((gint)(R0 + .5), 0, 255); 
+    g = CLAMP((gint)(G0 + .5), 0, 255); 
+    b = CLAMP((gint)(B0 + .5), 0, 255); 
+
+    r = CLAMP((gint)(r + .5), 0, 255); 
+    g = CLAMP((gint)(g + .5), 0, 255); 
+    b = CLAMP((gint)(b + .5), 0, 255); 
+
+    ct_test(test, testutils_check_rgb_uint8(GEGL_IMAGE_OP(copy2), r, g, b)); 
+
+    g_object_unref(copy1);
+    g_object_unref(copy2);
+  }
+}
+
+static void
+copy_test_setup(Test *test)
+{
+  source = g_object_new(GEGL_TYPE_COLOR, 
+                        "width", IMAGE_OP_WIDTH, 
+                        "height", IMAGE_OP_HEIGHT, 
+                        "pixel-rgb-uint8", R0, G0, B0, 
+                        NULL); 
+
+}
+
+static void
+copy_test_teardown(Test *test)
+{
+  g_object_unref(source);
+}
+
+Test *
+create_copy_test_rgb_uint8()
+{
+  Test* t = ct_create("GeglCopyTestRgbUint8");
+
+  g_assert(ct_addSetUp(t, copy_test_setup));
+  g_assert(ct_addTearDown(t, copy_test_teardown));
+
+#if 1 
+  g_assert(ct_addTestFun(t, test_copy_g_object_new));
+  g_assert(ct_addTestFun(t, test_copy_g_object_properties));
+  g_assert(ct_addTestFun(t, test_copy_apply));
+#endif
+
+  return t; 
+}
diff --recursive -u -p -P gegl/tests/testgegl.c gegl-new/tests/testgegl.c
--- gegl/tests/testgegl.c	2003-02-11 17:39:15.000000000 -0800
+++ gegl-new/tests/testgegl.c	2003-02-21 14:49:58.000000000 -0800
@@ -16,6 +16,8 @@ extern Test * create_color_model_test();
 extern Test * create_color_space_test();
 extern Test * create_color_test_rgb_float();
 extern Test * create_color_test_rgb_uint8();
+extern Test * create_copy_test_rgb_float();
+extern Test * create_copy_test_rgb_uint8();
 extern Test * create_dump_visitor_test();
 extern Test * create_channel_space_test();
 extern Test * create_buffer_test();
@@ -81,6 +83,8 @@ main (int argc, char *argv[])
     cs_addTest(suite, create_buffer_test());
     cs_addTest(suite, create_dfs_visitor_test());
     cs_addTest(suite, create_dump_visitor_test());
+    cs_addTest(suite, create_copy_test_rgb_float());
+    cs_addTest(suite, create_copy_test_rgb_uint8());
     cs_addTest(suite, create_fade_test_rgb_float());
     cs_addTest(suite, create_fade_test_rgb_uint8());
     cs_addTest(suite, create_graph_apply_test_rgb_float());

[Index of Archives]     [Yosemite News]     [Yosemite Photos]     [gtk]     [GIMP Users]     [KDE]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux