mirror of https://github.com/GNOME/gimp.git
plug-ins: improve a bit PDF export progression.
Subdivise progression steps inside layer groups. It is not perfect yet as it would not handle perfectly weird edge cases where you have for instance a lot of layers in a top layer group with only many other top layers. But it would still handle it better than before. Ideally we should simply count all non-group "leaf" layers in the layer tree and use this as the number of steps. In other words, we should do a first pass through the whole layer tree.
This commit is contained in:
parent
708bdf325a
commit
e88107153c
|
@ -284,6 +284,9 @@ static gboolean draw_layer (GimpLayer **layers,
|
|||
gdouble x_res,
|
||||
gdouble y_res,
|
||||
const gchar *name,
|
||||
gboolean show_progress,
|
||||
gdouble progress_start,
|
||||
gdouble progress_end,
|
||||
GError **error);
|
||||
|
||||
|
||||
|
@ -855,14 +858,14 @@ pdf_save_image (GimpProcedure *procedure,
|
|||
/* Now, we should loop over the layers of each image */
|
||||
for (j = 0; j < n_layers; j++)
|
||||
{
|
||||
if (show_progress)
|
||||
/* Progression is showed per image, and would restart at 0
|
||||
* if you open several images.
|
||||
*/
|
||||
gimp_progress_update ((gdouble) j / n_layers);
|
||||
|
||||
if (! draw_layer (layers, n_layers, j, cr, x_res, y_res,
|
||||
gimp_procedure_get_name (procedure),
|
||||
show_progress,
|
||||
/* Progression is showed per image, and would restart at 0
|
||||
* if you open several images.
|
||||
*/
|
||||
(gdouble) j / n_layers,
|
||||
(gdouble) (j + 1) / n_layers,
|
||||
&error))
|
||||
{
|
||||
/* free the resources */
|
||||
|
@ -1916,6 +1919,9 @@ draw_layer (GimpLayer **layers,
|
|||
gdouble x_res,
|
||||
gdouble y_res,
|
||||
const gchar *name,
|
||||
gboolean show_progress,
|
||||
gdouble progress_start,
|
||||
gdouble progress_end,
|
||||
GError **error)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
|
@ -1941,7 +1947,11 @@ draw_layer (GimpLayer **layers,
|
|||
for (i = 0; i < children_num; i++)
|
||||
{
|
||||
if (! draw_layer ((GimpLayer **) children, children_num, i,
|
||||
cr, x_res, y_res, name, error))
|
||||
cr, x_res, y_res, name,
|
||||
show_progress,
|
||||
progress_start + i * (progress_end - progress_start) / children_num,
|
||||
progress_end,
|
||||
error))
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
|
@ -1955,6 +1965,9 @@ draw_layer (GimpLayer **layers,
|
|||
GimpLayerMask *mask = NULL;
|
||||
gint x, y;
|
||||
|
||||
if (show_progress)
|
||||
gimp_progress_update (progress_start);
|
||||
|
||||
mask = gimp_layer_get_mask (layer);
|
||||
if (mask)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue