gegl r1857 - in trunk: . gegl/buffer



Author: neo
Date: Fri Jan 18 10:46:47 2008
New Revision: 1857
URL: http://svn.gnome.org/viewvc/gegl?rev=1857&view=rev

Log:
2008-01-18  Sven Neumann  <sven gimp org>

	* gegl/buffer/gegl-tile.c: don't use GSlice for the tile data.


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-tile.c

Modified: trunk/gegl/buffer/gegl-tile.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile.c	(original)
+++ trunk/gegl/buffer/gegl-tile.c	Fri Jan 18 10:46:47 2008
@@ -112,7 +112,7 @@
     {
       if (tile->next_shared == tile)
         { /* no clones */
-          g_slice_free1 (tile->size, tile->data);
+          g_free (tile->data);
           tile->data = NULL;
         }
       else
@@ -170,17 +170,6 @@
   tile->prev_shared = tile;
 }
 
-static inline GeglTile *
-gegl_tile_new_from_data (guchar *data,
-                         gint    size)
-{
-  GeglTile *tile = g_object_new (GEGL_TYPE_TILE, NULL);
-
-  tile->data = data;
-  tile->size = size;
-  return tile;
-}
-
 GeglTile *
 gegl_tile_dup (GeglTile *src)
 {
@@ -196,19 +185,19 @@
   src->next_shared               = tile;
   tile->prev_shared              = src;
   tile->next_shared->prev_shared = tile;
+
   return tile;
 }
 
 GeglTile *
 gegl_tile_new (gint size)
 {
-  GeglTile *tile;
-
-  guchar   *data = g_slice_alloc (size);
-
-  tile = gegl_tile_new_from_data (data, size);
+  GeglTile *tile = g_object_new (GEGL_TYPE_TILE, NULL);
 
+  tile->data       = g_malloc (size);
+  tile->size       = size;
   tile->stored_rev = 1;
+
   return tile;
 }
 
@@ -217,13 +206,10 @@
 {
   if (tile->next_shared != tile)
     {
-      gint    buflen = tile->size;
       /* the tile data is shared with other tiles,
        * create a local copy
        */
-      guchar *data = g_slice_alloc (buflen);
-      memcpy (data, tile->data, buflen);
-      tile->data                     = data;
+      tile->data                     = g_memdup (tile->data, tile->size);
       tile->prev_shared->next_shared = tile->next_shared;
       tile->next_shared->prev_shared = tile->prev_shared;
       tile->prev_shared              = tile;
@@ -352,7 +338,7 @@
 {
   gegl_tile_lock (dst);
 
-  g_slice_free1 (dst->size, dst->data);
+  g_free (dst->data);
   dst->data = NULL;
 
   dst->next_shared              = src->next_shared;



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