[gimp] app: use gegl_tile_handler_damage_rect() in TileHandlerValidate



commit 4acdc7392af74d09a281f334d06841e32c006547
Author: Ell <ell_se yahoo com>
Date:   Sat Mar 31 11:49:01 2018 -0400

    app: use gegl_tile_handler_damage_rect() in TileHandlerValidate
    
    Use the recently-added gegl_tile_handler_damage_rect() function
    during GimpTileHandlerValidate invalidation, instead of manually
    voiding the tile pyramid.  This function avoids voiding mipmapped
    tiles entirely when only a subarea of the tile needs to be redrawn.
    
    See GEGL commit 3210f4ffc3c569a2acd9483811cb141070112bc6.

 app/gegl/gimptilehandlervalidate.c |   28 +---------------------------
 app/gegl/gimptilehandlervalidate.h |    1 -
 2 files changed, 1 insertions(+), 28 deletions(-)
---
diff --git a/app/gegl/gimptilehandlervalidate.c b/app/gegl/gimptilehandlervalidate.c
index f62a6ad..7e40ab3 100644
--- a/app/gegl/gimptilehandlervalidate.c
+++ b/app/gegl/gimptilehandlervalidate.c
@@ -316,8 +316,6 @@ gimp_tile_handler_validate_command (GeglTileSource  *source,
   GimpTileHandlerValidate *validate = GIMP_TILE_HANDLER_VALIDATE (source);
   gpointer                 retval;
 
-  validate->max_z = MAX (validate->max_z, z);
-
   retval = gegl_tile_handler_source_command (source, command, x, y, z, data);
 
   if (command == GEGL_TILE_GET && z == 0)
@@ -382,31 +380,7 @@ gimp_tile_handler_validate_invalidate (GimpTileHandlerValidate *validate,
   cairo_region_union_rectangle (validate->dirty_region,
                                 (cairo_rectangle_int_t *) rect);
 
-  if (validate->max_z > 0)
-    {
-      GeglTileSource *source  = GEGL_TILE_SOURCE (validate);
-      gint            tile_x1 = rect->x / validate->tile_width;
-      gint            tile_y1 = rect->y / validate->tile_height;
-      gint            tile_x2 = (rect->x + rect->width  - 1) /
-                                validate->tile_width + 1;
-      gint            tile_y2 = (rect->y + rect->height - 1) /
-                                validate->tile_height + 1;
-      gint            tile_x;
-      gint            tile_y;
-      gint            tile_z;
-
-      for (tile_z = 1; tile_z <= validate->max_z; tile_z++)
-        {
-          tile_y1 = tile_y1 / 2;
-          tile_y2 = (tile_y2 + 1) / 2;
-          tile_x1 = tile_x1 / 2;
-          tile_x2 = (tile_x2 + 1) / 2;
-
-          for (tile_y = tile_y1; tile_y < tile_y2; tile_y++)
-            for (tile_x = tile_x1; tile_x < tile_x2; tile_x++)
-              gegl_tile_source_void (source, tile_x, tile_y, tile_z);
-        }
-    }
+  gegl_tile_handler_damage_rect (GEGL_TILE_HANDLER (validate), rect);
 }
 
 void
diff --git a/app/gegl/gimptilehandlervalidate.h b/app/gegl/gimptilehandlervalidate.h
index fa3f00d..225ce84 100644
--- a/app/gegl/gimptilehandlervalidate.h
+++ b/app/gegl/gimptilehandlervalidate.h
@@ -47,7 +47,6 @@ struct _GimpTileHandlerValidate
   const Babl      *format;
   gint             tile_width;
   gint             tile_height;
-  gint             max_z;
   gboolean         whole_tile;
 };
 


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