[gegl/soc-2011-warp] gegl:warp: add code to test copy on write



commit 19b17d441007fa6af1f5e93dfed75e64a52744ab
Author: Michael Murà <batolettre gmail com>
Date:   Sat Jul 30 02:08:21 2011 +0200

    gegl:warp: add code to test copy on write

 operations/workshop/warp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/operations/workshop/warp.c b/operations/workshop/warp.c
index c662789..55c3ad8 100644
--- a/operations/workshop/warp.c
+++ b/operations/workshop/warp.c
@@ -21,6 +21,12 @@
 #include <math.h>
 #include <stdio.h> /* for test only */
 
+/* #define COPY_ON_WRITE */
+#ifndef COPY_ON_WRITE
+#include "gegl.h"
+#include "gegl-buffer-private.h"
+#endif
+
 #ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (strength, _("Strength"), 0.0, 100.0, 1.0,
@@ -315,7 +321,14 @@ process (GeglOperation       *operation,
 
   printf("Process %p\n", operation);
 
+#ifdef COPY_ON_WRITE
   priv->buffer = gegl_buffer_dup (input);
+#else
+  g_assert (GEGL_IS_BUFFER (input));
+
+  priv->buffer = gegl_buffer_new (gegl_buffer_get_extent (input), input->format);
+  gegl_buffer_copy (input, gegl_buffer_get_extent (input), priv->buffer, gegl_buffer_get_extent (input));
+#endif
 
   event = gegl_path_get_path (o->stroke);
 



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