[gimp] plug-ins: add progression to PDF exporting.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: add progression to PDF exporting.
- Date: Sun, 14 Feb 2021 23:03:37 +0000 (UTC)
commit 6b281e8f00f469773c63e1fc1f42af2b0ed4ab63
Author: Jehan <jehan girinstud io>
Date: Sun Feb 14 23:51:25 2021 +0100
plug-ins: add progression to PDF exporting.
PDF exporting had no progression. In particular when exporting a PDF
with more a hundred pages today, it took maybe 20 secs without any
progression status, which is annoying.
Limitations:
1. When exporting as multi-images, we reset to 0 at each image. I am
actually not sure if this is the expected behavior.
2. I am updating the progression per top layer, not doing finer grained
progression steps. An extreme case would be a single top layer group
with many children layers inside. Yet I wanted to avoid too much
progression updates for the normal cases.
plug-ins/common/file-pdf-save.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index 1e420e705e..be854c81ef 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -235,7 +235,8 @@ static GimpValueArray * pdf_save_multi (GimpProcedure *procedur
static GimpValueArray * pdf_save_image (GimpProcedure *procedure,
gboolean single_image,
- gboolean defaults_proc);
+ gboolean defaults_proc,
+ gboolean show_progress);
static void init_image_list_defaults (GimpImage *image);
@@ -553,7 +554,8 @@ pdf_save (GimpProcedure *procedure,
}
}
- return pdf_save_image (procedure, TRUE, defaults);
+ return pdf_save_image (procedure, TRUE, defaults,
+ (run_mode != GIMP_RUN_NONINTERACTIVE));
}
static GimpValueArray *
@@ -631,7 +633,8 @@ pdf_save_multi (GimpProcedure *procedure,
}
}
- return pdf_save_image (procedure, FALSE, FALSE);
+ return pdf_save_image (procedure, FALSE, FALSE,
+ (run_mode != GIMP_RUN_NONINTERACTIVE));
}
static cairo_status_t
@@ -714,7 +717,8 @@ get_missing_fonts (GList *layers)
static GimpValueArray *
pdf_save_image (GimpProcedure *procedure,
gboolean single_image,
- gboolean defaults_proc)
+ gboolean defaults_proc,
+ gboolean show_progress)
{
cairo_surface_t *pdf_file;
cairo_t *cr;
@@ -851,6 +855,12 @@ 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),
&error))
@@ -866,6 +876,8 @@ pdf_save_image (GimpProcedure *procedure,
error);
}
}
+ if (show_progress)
+ gimp_progress_update (1.0);
g_free (layers);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]