[gegl] buffer: prevent mipmapped tiles from being voided during reconstruction



commit 3557811a5527bccbfef2006046a05047b6edd480
Author: Ell <ell_se yahoo com>
Date:   Wed May 2 15:03:04 2018 -0400

    buffer: prevent mipmapped tiles from being voided during reconstruction
    
    While fetching a partially damaged mipmapped tile, make sure that
    fetching its lower-level tiles, during the mipmapped tile's
    reconstruction, doesn't cause the tile to be voided and dropped
    from the cache.  This can happen if the tile handler responsible
    for the lower-level tile rewrites its contents (as can happen, for
    example, with a GimpTileHandlerValidate), causing the corresponding
    porition of the pyramid to be voided.
    
    We prevent the mipmapped tile from being voided by clearing its
    damaged region before fetching each lower-level tile, so that any
    damage to the lower-level tile can never cause the entire mipmapped
    tile to be damaged.

 gegl/buffer/gegl-tile-handler-zoom.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index 79fd563..d104559 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -180,6 +180,18 @@ get_tile (GeglTileSource *gegl_tile_source,
         {
           if ((damage >> (32 * j + 16 * i)) & 0xffff)
             {
+              /* clear the tile damage region before fetching each lower-level
+               * tile, so that if this results in the corresponding portion of
+               * the pyramid being voided, our damage region never covers the
+               * entire tile, and we're not getting dropped from the cache.
+               *
+               * note that our damage region is cleared at the end of the
+               * process by gegl_tile_unlock() anyway, so clearing it here is
+               * harmless.
+               */
+              if (tile)
+                tile->damage = 0;
+
               /* we get the tile from ourselves, to make successive rescales
                * work correctly */
               source_tile[i][j] = gegl_tile_source_get_tile (


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