[gegl] buffer: fix gegl_tile_handler_cache_copy() for GeglTileBackendBuffer backends
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: fix gegl_tile_handler_cache_copy() for GeglTileBackendBuffer backends
- Date: Sun, 5 May 2019 16:04:33 +0000 (UTC)
commit bffe61914552931381432e123f72d481c53044c0
Author: Ell <ell_se yahoo com>
Date: Sun May 5 11:59:13 2019 -0400
buffer: fix gegl_tile_handler_cache_copy() for GeglTileBackendBuffer backends
In gegl_tile_handler_cache_copy(), when the source cache doesn't
have the requested tile, remove the tile from the destination cache
*before* letting the backend copy the tile, since it might copy it
into the destination cache as well, as happens with
GeglTileBackendBuffer. Previously, this would happen *after* the
backend copied the tile, erroneously invalidating the copied tile
in this case. See issue #157.
Also, don't invalidate the destination tile in this case, since
gegl_buffer_copy() invalidates the entire affected region in bulk.
gegl/buffer/gegl-tile-handler-cache.c | 52 ++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index fde419908..4f35ec424 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -745,6 +745,30 @@ gegl_tile_handler_cache_copy (GeglTileHandlerCache *cache,
success = TRUE;
}
+ /* otherwise, if we don't have the tile, remove the corresponding tile from
+ * the destination cache, so that, if the backend copies the tile to the
+ * destination backend below, the destination cache doesn't hold an outdated
+ * tile. we do this *before* letting the backend copy the tile, since the
+ * backend might insert the copied tile to the destination cache as well, as
+ * is the case for GeglTileBackendBuffer.
+ */
+ else
+ {
+ GeglTileHandlerCache *dst_cache;
+
+ if (params->dst_buffer)
+ dst_cache = params->dst_buffer->tile_storage->cache;
+ else
+ dst_cache = cache;
+
+ if (dst_cache)
+ {
+ gegl_tile_handler_cache_remove (dst_cache,
+ params->dst_x,
+ params->dst_y,
+ params->dst_z);
+ }
+ }
/* then, if we don't have the tile, or if the tile is stored, iow, if the
* tile might exist in the backend in an up-to-date state ...
@@ -758,33 +782,11 @@ gegl_tile_handler_cache_copy (GeglTileHandlerCache *cache,
GEGL_TILE_COPY, x, y, z,
(gpointer) params))
{
- /* if the backend copied the tile, we can either mark the copied tile
- * as stored, or, if we didn't have the tile, void any existing tile
- * in the destination cache.
+ /* if the backend copied the tile, we can mark the copied tile, if
+ * exists, as stored.
*/
-
if (dst_tile)
- {
- gegl_tile_mark_as_stored (dst_tile);
- }
- else
- {
- GeglTileHandlerCache *dst_cache;
-
- if (params->dst_buffer)
- dst_cache = params->dst_buffer->tile_storage->cache;
- else
- dst_cache = cache;
-
- if (dst_cache)
- {
- gegl_tile_handler_cache_void (dst_cache,
- params->dst_x,
- params->dst_y,
- params->dst_z,
- ~(guint64) 0);
- }
- }
+ gegl_tile_mark_as_stored (dst_tile);
success = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]