gegl r1882 - in trunk: . gegl/buffer



Author: neo
Date: Mon Jan 21 12:29:53 2008
New Revision: 1882
URL: http://svn.gnome.org/viewvc/gegl?rev=1882&view=rev

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

	* gegl/buffer/gegl-buffer-load.c
	* gegl/buffer/gegl-buffer-save.c: don't append to linked lists.
	Instead prepend all items, then reverse the list.


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-buffer-load.c
   trunk/gegl/buffer/gegl-buffer-save.c

Modified: trunk/gegl/buffer/gegl-buffer-load.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-load.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-load.c	Mon Jan 21 12:29:53 2008
@@ -125,8 +125,9 @@
 
         read (info->fd, entry, sizeof (GeglTileEntry));
 
-        info->tiles = g_list_append (info->tiles, entry);
+        info->tiles = g_list_prepend (info->tiles, entry);
       }
+    info->tiles = g_list_reverse (info->tiles);
   }
 
   /* load each tile */

Modified: trunk/gegl/buffer/gegl-buffer-save.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-save.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-save.c	Mon Jan 21 12:29:53 2008
@@ -98,10 +98,7 @@
     {
       GList *iter;
       for (iter = info->tiles; iter; iter = iter->next)
-        {
-          GeglTileEntry *entry = iter->data;
-          tile_entry_destroy (entry);
-        }
+        tile_entry_destroy (iter->data);
       g_list_free (info->tiles);
       info->tiles = NULL;
     }
@@ -143,10 +140,7 @@
   const GeglTileEntry *entryA = a;
   const GeglTileEntry *entryB = b;
 
-  glong                zA = z_order (entryA);
-  glong                zB = z_order (entryB);
-
-  return zB - zA;
+  return z_order (entryB) - z_order (entryA);
 }
 
 void
@@ -228,16 +222,13 @@
                   gint tx = gegl_tile_indice (tiledx / factor, tile_width);
                   gint ty = gegl_tile_indice (tiledy / factor, tile_height);
 
-                  if (1)
+                  if (gegl_provider_message (GEGL_PROVIDER (buffer),
+                                             GEGL_TILE_EXIST, tx, ty, z, NULL))
                     {
-                      if (gegl_provider_message (GEGL_PROVIDER (buffer),
-                                                   GEGL_TILE_EXIST, tx, ty, z, NULL))
-                        {
-                          tx += info->x_tile_shift / factor;
-                          ty += info->y_tile_shift / factor;
+                      tx += info->x_tile_shift / factor;
+                      ty += info->y_tile_shift / factor;
 
-                          info->tiles = g_list_append (info->tiles, tile_entry_new (tx, ty, z));
-                        }
+                      info->tiles = g_list_prepend (info->tiles, tile_entry_new (tx, ty, z));
                     }
                   bufx += (tile_width - offsetx) * factor;
                 }
@@ -246,6 +237,8 @@
           factor *= 2;
         }
     }
+
+    info->tiles = g_list_reverse (info->tiles);
   }
 
   info->header.tile_count = g_list_length (info->tiles);



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