Commit 15771747 authored by Ell's avatar Ell

app: update projection-buffer extent when projectable size changes

In GimpProjection, when the projectable's size changes, while its
offset remains the same, simply update the projection buffer's
extent, instead of allocating a new buffer and copying the contents
over.
parent b4ee9ff0
Pipeline #104253 passed with stages
in 17 minutes
......@@ -1042,33 +1042,38 @@ gimp_projection_projectable_bounds_changed (GimpProjectable *projectable,
gimp_projection_chunk_render_stop (proj, TRUE);
old_validate_handler = proj->priv->validate_handler;
proj->priv->buffer = NULL;
proj->priv->validate_handler = NULL;
if (dx == 0 && dy == 0)
{
gimp_tile_handler_validate_buffer_set_extent (old_buffer, &bounding_box);
}
else
{
old_validate_handler = proj->priv->validate_handler;
gimp_projection_allocate_buffer (proj);
proj->priv->buffer = NULL;
proj->priv->validate_handler = NULL;
gimp_tile_handler_validate_buffer_copy (old_buffer,
GEGL_RECTANGLE (int_bounds.x - old_x,
int_bounds.y - old_y,
int_bounds.width,
int_bounds.height),
proj->priv->buffer,
GEGL_RECTANGLE (int_bounds.x - x,
int_bounds.y - y,
int_bounds.width,
int_bounds.height));
gimp_projection_allocate_buffer (proj);
if (old_validate_handler)
{
gimp_tile_handler_validate_unassign (old_validate_handler, old_buffer);
gimp_tile_handler_validate_buffer_copy (
old_buffer,
GEGL_RECTANGLE (int_bounds.x - old_x,
int_bounds.y - old_y,
int_bounds.width,
int_bounds.height),
proj->priv->buffer,
GEGL_RECTANGLE (int_bounds.x - x,
int_bounds.y - y,
int_bounds.width,
int_bounds.height));
gimp_tile_handler_validate_unassign (old_validate_handler,
old_buffer);
g_object_unref (old_validate_handler);
g_object_unref (old_buffer);
}
g_object_unref (old_buffer);
if (proj->priv->update_region)
{
cairo_region_translate (proj->priv->update_region, dx, dy);
......
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