app: add gimp_projection_stop_rendering()

which stops a running chunk renderer and moves its remaining
unrendered region back to the projection's dirty region.
This commit is contained in:
Michael Natterer 2014-06-29 23:57:22 +02:00
parent 2ac5ab7dc3
commit 3795c597ba
2 changed files with 47 additions and 1 deletions

View File

@ -480,7 +480,7 @@ gimp_projection_set_priority_rect (GimpProjection *proj,
{
cairo_rectangle_int_t rect;
gint off_x, off_y;
gint width, height;
gint width, height;
g_return_if_fail (GIMP_IS_PROJECTION (proj));
@ -505,6 +505,50 @@ gimp_projection_set_priority_rect (GimpProjection *proj,
}
}
void
gimp_projection_stop_rendering (GimpProjection *proj)
{
GimpProjectionChunkRender *chunk_render;
cairo_rectangle_int_t rect;
g_return_if_fail (GIMP_IS_PROJECTION (proj));
chunk_render = &proj->priv->chunk_render;
if (! chunk_render->idle_id)
return;
if (chunk_render->update_region)
{
if (proj->priv->update_region)
{
cairo_region_union (proj->priv->update_region,
chunk_render->update_region);
}
else
{
proj->priv->update_region =
cairo_region_copy (chunk_render->update_region);
}
cairo_region_destroy (chunk_render->update_region);
chunk_render->update_region = NULL;
}
rect.x = chunk_render->x;
rect.y = chunk_render->work_y;
rect.width = chunk_render->width;
rect.height = chunk_render->height - (chunk_render->work_y - chunk_render->y);
/* FIXME this is too much, the entire current row */
if (proj->priv->update_region)
cairo_region_union_rectangle (proj->priv->update_region, &rect);
else
proj->priv->update_region = cairo_region_create_rectangle (&rect);
gimp_projection_chunk_render_stop (proj);
}
void
gimp_projection_flush (GimpProjection *proj)
{

View File

@ -63,6 +63,8 @@ void gimp_projection_set_priority_rect (GimpProjection *proj,
gint width,
gint height);
void gimp_projection_stop_rendering (GimpProjection *proj);
void gimp_projection_flush (GimpProjection *proj);
void gimp_projection_flush_now (GimpProjection *proj);
void gimp_projection_finish_draw (GimpProjection *proj);