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:
@ -1042,6 +1042,12 @@ gimp_projection_projectable_bounds_changed (GimpProjectable *projectable,
|
|||||||
|
|
||||||
gimp_projection_chunk_render_stop (proj, TRUE);
|
gimp_projection_chunk_render_stop (proj, TRUE);
|
||||||
|
|
||||||
|
if (dx == 0 && dy == 0)
|
||||||
|
{
|
||||||
|
gimp_tile_handler_validate_buffer_set_extent (old_buffer, &bounding_box);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
old_validate_handler = proj->priv->validate_handler;
|
old_validate_handler = proj->priv->validate_handler;
|
||||||
|
|
||||||
proj->priv->buffer = NULL;
|
proj->priv->buffer = NULL;
|
||||||
@ -1049,7 +1055,8 @@ gimp_projection_projectable_bounds_changed (GimpProjectable *projectable,
|
|||||||
|
|
||||||
gimp_projection_allocate_buffer (proj);
|
gimp_projection_allocate_buffer (proj);
|
||||||
|
|
||||||
gimp_tile_handler_validate_buffer_copy (old_buffer,
|
gimp_tile_handler_validate_buffer_copy (
|
||||||
|
old_buffer,
|
||||||
GEGL_RECTANGLE (int_bounds.x - old_x,
|
GEGL_RECTANGLE (int_bounds.x - old_x,
|
||||||
int_bounds.y - old_y,
|
int_bounds.y - old_y,
|
||||||
int_bounds.width,
|
int_bounds.width,
|
||||||
@ -1060,14 +1067,12 @@ gimp_projection_projectable_bounds_changed (GimpProjectable *projectable,
|
|||||||
int_bounds.width,
|
int_bounds.width,
|
||||||
int_bounds.height));
|
int_bounds.height));
|
||||||
|
|
||||||
if (old_validate_handler)
|
gimp_tile_handler_validate_unassign (old_validate_handler,
|
||||||
{
|
old_buffer);
|
||||||
gimp_tile_handler_validate_unassign (old_validate_handler, old_buffer);
|
|
||||||
|
|
||||||
g_object_unref (old_validate_handler);
|
g_object_unref (old_validate_handler);
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (old_buffer);
|
g_object_unref (old_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
if (proj->priv->update_region)
|
if (proj->priv->update_region)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user