[gegl] buffer: always increase revision of duplicate tiles, even empty
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: always increase revision of duplicate tiles, even empty
- Date: Tue, 14 Aug 2018 08:02:26 +0000 (UTC)
commit 5a8c84e7711636099efedce70bd4c34c459cafdf
Author: Ell <ell_se yahoo com>
Date: Tue Aug 14 03:42:03 2018 -0400
buffer: always increase revision of duplicate tiles, even empty
In gegl_tile_dup(), increate the revision of the newly-created
duplicate tile unconditionally, even if it's empty, so that it gets
stored.
Instead of special-casing empty tiles in the above function, mark
newly-craeted empty tiles as stored in the empty-tile handler.
This way, newly-created empty tiles are not stored, but copied
empty tiles are, since we might need them to replace outdated data
in the tile backend. Tile backends may, in turn, test for empty
tiles upon a SET command, and drop the existing tile instead of
storing the empty tile.
Remove the now-unnecessary revision bump in gegl_buffer_copy().
gegl/buffer/gegl-buffer-access.c | 1 -
gegl/buffer/gegl-tile-handler-empty.c | 9 ++++++++-
gegl/buffer/gegl-tile.c | 8 +++-----
3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a95d6df4d..80e9128e3 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -2432,7 +2432,6 @@ gegl_buffer_copy (GeglBuffer *src,
dst_tile->x = dtx;
dst_tile->y = dty;
dst_tile->z = 0;
- dst_tile->rev++;
gegl_tile_handler_cache_insert (cache, dst_tile, dtx, dty, 0);
diff --git a/gegl/buffer/gegl-tile-handler-empty.c b/gegl/buffer/gegl-tile-handler-empty.c
index b8655d890..d4d481ed2 100644
--- a/gegl/buffer/gegl-tile-handler-empty.c
+++ b/gegl/buffer/gegl-tile-handler-empty.c
@@ -107,8 +107,15 @@ get_tile (GeglTileSource *gegl_tile_source,
empty->tile = _new_empty_tile (tile_size);
}
- return gegl_tile_handler_dup_tile (GEGL_TILE_HANDLER (empty),
+ tile = gegl_tile_handler_dup_tile (GEGL_TILE_HANDLER (empty),
empty->tile, x, y, z);
+
+ /* no need to store the tile, since we'll just create another empty tile on-
+ * demand if it's dropped.
+ */
+ gegl_tile_mark_as_stored (tile);
+
+ return tile;
}
static gpointer
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 57404acb8..0694ee801 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -143,12 +143,10 @@ gegl_tile_dup (GeglTile *src)
tile->clone_state = CLONE_STATE_CLONED;
tile->n_clones = src->n_clones;
- /* if the tile is not empty, mark it as dirty, since, even though the in-
- * memory tile data is shared with the source tile, the stored tile data is
- * separate.
+ /* mark the tile as dirty, since, even though the in-memory tile data is
+ * shared with the source tile, the stored tile data is separate.
*/
- if (! tile->is_zero_tile)
- tile->rev++;
+ tile->rev++;
tile->destroy_notify = src->destroy_notify;
tile->destroy_notify_data = src->destroy_notify_data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]