mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
b4ee9ff055
commit
1577174739
|
@ -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;
|
||||
|
||||
gimp_projection_allocate_buffer (proj);
|
||||
|
||||
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));
|
||||
|
||||
if (old_validate_handler)
|
||||
if (dx == 0 && dy == 0)
|
||||
{
|
||||
gimp_tile_handler_validate_unassign (old_validate_handler, old_buffer);
|
||||
gimp_tile_handler_validate_buffer_set_extent (old_buffer, &bounding_box);
|
||||
}
|
||||
else
|
||||
{
|
||||
old_validate_handler = proj->priv->validate_handler;
|
||||
|
||||
proj->priv->buffer = NULL;
|
||||
proj->priv->validate_handler = NULL;
|
||||
|
||||
gimp_projection_allocate_buffer (proj);
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue