[gegl] buffer: Add gegl_tile_mark_as_stored()
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: Add gegl_tile_mark_as_stored()
- Date: Fri, 23 Jul 2010 13:38:05 +0000 (UTC)
commit ad1009acf2b9222525d72c6c40d4035ebcbdf6d8
Author: Martin Nordholts <martinn src gnome org>
Date: Fri Jul 23 14:05:06 2010 +0200
buffer: Add gegl_tile_mark_as_stored()
We commonly want to mark a tile as stored, so add a function for that.
gegl/buffer/gegl-tile-backend-file.c | 8 ++++----
gegl/buffer/gegl-tile-backend-ram.c | 2 +-
gegl/buffer/gegl-tile-backend-tiledir.c | 2 +-
gegl/buffer/gegl-tile-handler-cache.c | 2 +-
gegl/buffer/gegl-tile.c | 6 ++++++
gegl/buffer/gegl-tile.h | 31 ++++++++++++++++---------------
6 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend-file.c b/gegl/buffer/gegl-tile-backend-file.c
index 2165b1a..089ce91 100644
--- a/gegl/buffer/gegl-tile-backend-file.c
+++ b/gegl/buffer/gegl-tile-backend-file.c
@@ -462,9 +462,9 @@ gegl_tile_backend_file_get_tile (GeglTileSource *self,
if (!entry)
return NULL;
- tile = gegl_tile_new (backend->tile_size);
- tile->rev = entry->rev;
- tile->stored_rev = entry->rev;
+ tile = gegl_tile_new (backend->tile_size);
+ tile->rev = entry->rev;
+ gegl_tile_mark_as_stored (tile);
gegl_tile_backend_file_file_entry_read (tile_backend_file, entry, tile->data);
return tile;
@@ -496,7 +496,7 @@ gegl_tile_backend_file_set_tile (GeglTileSource *self,
entry->rev = tile->rev;
gegl_tile_backend_file_file_entry_write (tile_backend_file, entry, tile->data);
- tile->stored_rev = tile->rev;
+ gegl_tile_mark_as_stored (tile);
return NULL;
}
diff --git a/gegl/buffer/gegl-tile-backend-ram.c b/gegl/buffer/gegl-tile-backend-ram.c
index f585bd7..30c22f7 100644
--- a/gegl/buffer/gegl-tile-backend-ram.c
+++ b/gegl/buffer/gegl-tile-backend-ram.c
@@ -185,7 +185,7 @@ gboolean set_tile (GeglTileSource *store,
g_hash_table_insert (tile_backend_ram->entries, entry, entry);
}
ram_entry_write (tile_backend_ram, entry, tile->data);
- tile->stored_rev = tile->rev;
+ gegl_tile_mark_as_stored (tile);
return TRUE;
}
diff --git a/gegl/buffer/gegl-tile-backend-tiledir.c b/gegl/buffer/gegl-tile-backend-tiledir.c
index 75d28f3..4e44f84 100644
--- a/gegl/buffer/gegl-tile-backend-tiledir.c
+++ b/gegl/buffer/gegl-tile-backend-tiledir.c
@@ -178,7 +178,7 @@ set_tile (GeglTileSource *store,
entry.z = z;
gio_entry_write (tile_backend_tiledir, &entry, tile->data);
- tile->stored_rev = tile->rev;
+ gegl_tile_mark_as_stored (tile);
return NULL;
}
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index f5c4d26..d293bf8 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -375,7 +375,7 @@ gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cache,
{
cache_total -= item->tile->size;
tile->tile_storage = NULL;
- tile->stored_rev = tile->rev; /* to cheat it out of being stored */
+ gegl_tile_mark_as_stored (tile); /* to cheat it out of being stored */
gegl_tile_unref (tile);
g_hash_table_remove (cache_ht, item);
g_slice_free (CacheItem, item);
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index cb94933..fafd1dd 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -243,6 +243,12 @@ gegl_tile_unlock (GeglTile *tile)
}
+void
+gegl_tile_mark_as_stored (GeglTile *tile)
+{
+ tile->stored_rev = tile->rev;
+}
+
gboolean
gegl_tile_is_stored (GeglTile *tile)
{
diff --git a/gegl/buffer/gegl-tile.h b/gegl/buffer/gegl-tile.h
index 9bf7b15..40e6df9 100644
--- a/gegl/buffer/gegl-tile.h
+++ b/gegl/buffer/gegl-tile.h
@@ -60,38 +60,39 @@ struct _GeglTile
gpointer destroy_notify_data;
};
-GeglTile * gegl_tile_new (gint size);
-GeglTile * gegl_tile_new_bare (void); /* special hack for linear bufs */
-GeglTile * gegl_tile_ref (GeglTile *tile);
-void gegl_tile_unref (GeglTile *tile);
-void * gegl_tile_get_format (GeglTile *tile);
+GeglTile * gegl_tile_new (gint size);
+GeglTile * gegl_tile_new_bare (void); /* special hack for linear bufs */
+GeglTile * gegl_tile_ref (GeglTile *tile);
+void gegl_tile_unref (GeglTile *tile);
+void * gegl_tile_get_format (GeglTile *tile);
/* lock a tile for writing, this would allow writing to buffers
* later gotten with get_data()
*/
-void gegl_tile_lock (GeglTile *tile);
+void gegl_tile_lock (GeglTile *tile);
/* unlock the tile notifying the tile that we're done manipulating
* the data.
*/
-void gegl_tile_unlock (GeglTile *tile);
+void gegl_tile_unlock (GeglTile *tile);
-gboolean gegl_tile_is_stored (GeglTile *tile);
-gboolean gegl_tile_store (GeglTile *tile);
-void gegl_tile_void (GeglTile *tile);
-GeglTile *gegl_tile_dup (GeglTile *tile);
+void gegl_tile_mark_as_stored (GeglTile *tile);
+gboolean gegl_tile_is_stored (GeglTile *tile);
+gboolean gegl_tile_store (GeglTile *tile);
+void gegl_tile_void (GeglTile *tile);
+GeglTile *gegl_tile_dup (GeglTile *tile);
/* utility low-level functions used by an undo system in horizon
* where the geglbufer originated, kept around in case they
* become useful again
*/
-void gegl_tile_swp (GeglTile *a,
- GeglTile *b);
-void gegl_tile_cpy (GeglTile *src,
- GeglTile *dst);
+void gegl_tile_swp (GeglTile *a,
+ GeglTile *b);
+void gegl_tile_cpy (GeglTile *src,
+ GeglTile *dst);
/* computes the positive integer remainder (also for negative dividends)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]