Commit 4acdc739 authored by Ell's avatar Ell

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.
parent da3c96f5
......@@ -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
......
......@@ -47,7 +47,6 @@ struct _GimpTileHandlerValidate
const Babl *format;
gint tile_width;
gint tile_height;
gint max_z;
gboolean whole_tile;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment