[gegl] buffer: add gegl_tile_needs_store() internal function
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: add gegl_tile_needs_store() internal function
- Date: Sun, 2 Dec 2018 14:41:39 +0000 (UTC)
commit bf6dd78e256e1a59d1504e7ba4193a150bd18377
Author: Ell <ell_se yahoo com>
Date: Sun Dec 2 09:30:28 2018 -0500
buffer: add gegl_tile_needs_store() internal function
... which determines if a tile will be needs to be stored. This is
a slightly stronger condition than ! gegl_tile_is_stored(): a tile
needs to be stored if it has an associated tile-storage, is
unstored, and is undamaged.
gegl/buffer/gegl-buffer-private.h | 1 +
gegl/buffer/gegl-tile.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 69ecefbd1..102502322 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -187,6 +187,7 @@ struct _GeglTile
gpointer unlock_notify_data;
};
+gboolean gegl_tile_needs_store (GeglTile *tile);
void gegl_tile_unlock_no_void (GeglTile *tile);
gboolean gegl_tile_damage (GeglTile *tile,
guint64 damage);
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index b7dc76f2d..bbedefd65 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -383,6 +383,14 @@ gegl_tile_is_stored (GeglTile *tile)
return tile->stored_rev == tile->rev;
}
+gboolean
+gegl_tile_needs_store (GeglTile *tile)
+{
+ return tile->tile_storage &&
+ ! gegl_tile_is_stored (tile) &&
+ ! tile->damage;
+}
+
void
gegl_tile_void (GeglTile *tile)
{
@@ -418,7 +426,7 @@ gboolean gegl_tile_store (GeglTile *tile)
gboolean ret;
if (gegl_tile_is_stored (tile))
return TRUE;
- if (tile->tile_storage == NULL || tile->damage)
+ else if (! gegl_tile_needs_store (tile))
return FALSE;
g_rec_mutex_lock (&tile->tile_storage->mutex);
@@ -426,7 +434,7 @@ gboolean gegl_tile_store (GeglTile *tile)
if (gegl_tile_is_stored (tile))
{
g_rec_mutex_unlock (&tile->tile_storage->mutex);
- return FALSE;
+ return TRUE;
}
ret = gegl_tile_source_set_tile (GEGL_TILE_SOURCE (tile->tile_storage),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]