app: speed up layer-group preview rendering

In gimp_drawable_get_sub_preview_async(), when the drawable buffer
has a validate handler (i.e., when the drawable is a group layer),
validate the requested area before calling gegl_buffer_get(), so
that the buffer is validated in a single step, instead of tile-by-
tile.

(cherry picked from commit 919ddce773)
This commit is contained in:
Ell
2020-03-14 13:24:50 +02:00
parent 422452b5da
commit cd4c81133a

View File

@ -330,11 +330,30 @@ static void
gimp_drawable_get_sub_preview_async_func (GimpAsync *async,
SubPreviewData *data)
{
GimpTempBuf *preview;
GimpTempBuf *preview;
GimpTileHandlerValidate *validate;
preview = gimp_temp_buf_new (data->rect.width, data->rect.height,
data->format);
validate = gimp_tile_handler_validate_get_assigned (data->buffer);
if (validate)
{
GeglRectangle rect;
rect.x = floor (data->rect.x / data->scale);
rect.y = floor (data->rect.y / data->scale);
rect.width = ceil ((data->rect.x + data->rect.width) / data->scale) -
rect.x;
rect.height = ceil ((data->rect.x + data->rect.height) / data->scale) -
rect.y;
gimp_tile_handler_validate_validate (validate,
data->buffer, &rect,
TRUE, TRUE);
}
gegl_buffer_get (data->buffer, &data->rect, data->scale,
gimp_temp_buf_get_format (preview),
gimp_temp_buf_get_data (preview),