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



commit a341c3b6eeecc67206d42798912e67f4f97bcfc3
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 00fad21..4c27bbb 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, 50,
@@ -321,7 +327,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]