app: change GimpTileHandlerValidate's API to use GeglRectangle

instead of x, y, width, height.
This commit is contained in:
Michael Natterer 2017-08-05 15:43:41 +02:00
parent bf6c3cb4ba
commit 12f920d8bf
4 changed files with 21 additions and 31 deletions

View File

@ -943,14 +943,14 @@ gimp_projection_paint_area (GimpProjection *proj,
{
if (proj->priv->validate_handler)
gimp_tile_handler_validate_invalidate (proj->priv->validate_handler,
x, y, w, h);
GEGL_RECTANGLE (x, y, w, h));
if (now)
{
GeglNode *graph = gimp_projectable_get_graph (proj->priv->projectable);
if (proj->priv->validate_handler)
gimp_tile_handler_validate_undo_invalidate (proj->priv->validate_handler,
x, y, w, h);
GEGL_RECTANGLE (x, y, w, h));
gegl_node_blit_buffer (graph, proj->priv->buffer,
GEGL_RECTANGLE (x, y, w, h), 0, GEGL_ABYSS_NONE);

View File

@ -361,24 +361,23 @@ gimp_tile_handler_validate_assign (GimpTileHandlerValidate *validate,
void
gimp_tile_handler_validate_invalidate (GimpTileHandlerValidate *validate,
gint x,
gint y,
gint width,
gint height)
GeglRectangle *rect)
{
cairo_rectangle_int_t rect = { x, y, width, height };
g_return_if_fail (GIMP_IS_TILE_HANDLER_VALIDATE (validate));
g_return_if_fail (rect != NULL);
cairo_region_union_rectangle (validate->dirty_region, &rect);
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 = x / validate->tile_width;
gint tile_y1 = y / validate->tile_height;
gint tile_x2 = (x + width - 1) / validate->tile_width + 1;
gint tile_y2 = (y + height - 1) / validate->tile_height + 1;
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;
@ -399,14 +398,11 @@ gimp_tile_handler_validate_invalidate (GimpTileHandlerValidate *validate,
void
gimp_tile_handler_validate_undo_invalidate (GimpTileHandlerValidate *validate,
gint x,
gint y,
gint width,
gint height)
GeglRectangle *rect)
{
cairo_rectangle_int_t rect = { x, y, width, height };
g_return_if_fail (GIMP_IS_TILE_HANDLER_VALIDATE (validate));
g_return_if_fail (rect != NULL);
cairo_region_subtract_rectangle (validate->dirty_region, &rect);
cairo_region_subtract_rectangle (validate->dirty_region,
(cairo_rectangle_int_t *) rect);
}

View File

@ -71,15 +71,9 @@ void gimp_tile_handler_validate_assign (GimpTileHandlerValidate
GeglBuffer *buffer);
void gimp_tile_handler_validate_invalidate (GimpTileHandlerValidate *validate,
gint x,
gint y,
gint width,
gint height);
GeglRectangle *rect);
void gimp_tile_handler_validate_undo_invalidate (GimpTileHandlerValidate *validate,
gint x,
gint y,
gint width,
gint height);
GeglRectangle *rect);
G_END_DECLS

View File

@ -1856,9 +1856,9 @@ gradient_map_new (GimpPickable *pickable)
buffer);
gimp_tile_handler_validate_invalidate (GIMP_TILE_HANDLER_VALIDATE (handler),
0, 0,
gegl_buffer_get_width (buffer),
gegl_buffer_get_height (buffer));
GEGL_RECTANGLE (0, 0,
gegl_buffer_get_width (buffer),
gegl_buffer_get_height (buffer)));
g_object_unref (handler);