[gimp] plug-ins: clean and fix webp export.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: clean and fix webp export.
- Date: Tue, 8 Nov 2016 00:40:55 +0000 (UTC)
commit 8fdee80ff8ff7ac3d9301ac5e0abeea3e14c03f9
Author: Jehan <jehan girinstud io>
Date: Tue Nov 8 01:26:25 2016 +0100
plug-ins: clean and fix webp export.
- Default parameters must be set before gimp_get_data(). Otherwise
when you export the first time, you end up with broken defaults
(basically everything to 0, in particular a problem with quality
values of 0 which makes an export failure).
- Some minor formatting here and there and an unused variable.
plug-ins/file-webp/file-webp-dialog.c | 3 +--
plug-ins/file-webp/file-webp-save.c | 10 +++++++---
plug-ins/file-webp/file-webp.c | 23 +++++++++++++++++------
3 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/plug-ins/file-webp/file-webp-dialog.c b/plug-ins/file-webp/file-webp-dialog.c
index 7f8aff1..213798b 100644
--- a/plug-ins/file-webp/file-webp-dialog.c
+++ b/plug-ins/file-webp/file-webp-dialog.c
@@ -127,7 +127,7 @@ save_dialog (WebPSaveParams *params,
/* Create the descriptive label at the top */
text = g_strdup_printf ("<b>%s</b>", _("WebP Options"));
label = gtk_label_new (NULL);
- gtk_label_set_markup(GTK_LABEL(label), text);
+ gtk_label_set_markup (GTK_LABEL(label), text);
g_free (text);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
@@ -227,7 +227,6 @@ save_dialog (WebPSaveParams *params,
{
GtkWidget *animation_box;
GtkWidget *animation_box2;
- GtkWidget *animation_label;
GtkWidget *loop_anim_checkbox;
GtkWidget *animation_expander;
GtkWidget *animation_frame;
diff --git a/plug-ins/file-webp/file-webp-save.c b/plug-ins/file-webp/file-webp-save.c
index ea072e0..c38d8b6 100644
--- a/plug-ins/file-webp/file-webp-save.c
+++ b/plug-ins/file-webp/file-webp-save.c
@@ -407,11 +407,15 @@ parse_ms_tag (const gchar *str)
}
static gint
-get_layer_delay(gint32 layer)
+get_layer_delay (gint32 layer)
{
- gchar *layer_name = gimp_item_get_name (layer);
- gint delay_ms = parse_ms_tag (layer_name);
+ gchar *layer_name;
+ gint delay_ms;
+
+ layer_name = gimp_item_get_name (layer);
+ delay_ms = parse_ms_tag (layer_name);
g_free (layer_name);
+
return delay_ms;
}
diff --git a/plug-ins/file-webp/file-webp.c b/plug-ins/file-webp/file-webp.c
index 0247e61..3daa0ed 100644
--- a/plug-ins/file-webp/file-webp.c
+++ b/plug-ins/file-webp/file-webp.c
@@ -86,8 +86,8 @@ query (void)
{ GIMP_PDB_INT32, "exif", "Toggle saving exif data (0/1)" },
{ GIMP_PDB_INT32, "iptc", "Toggle saving iptc data (0/1)" },
{ GIMP_PDB_INT32, "xmp", "Toggle saving xmp data (0/1)" },
- { GIMP_PDB_INT32, "delay", "Delay to use when timestamp are not available or forced" },
- { GIMP_PDB_INT32, "force-delay", "Toggle to for delay" }
+ { GIMP_PDB_INT32, "delay", "Delay to use when timestamps are not available or forced" },
+ { GIMP_PDB_INT32, "force-delay", "Force delay on all frames" }
};
gimp_install_procedure (LOAD_PROC,
@@ -188,9 +188,21 @@ run (const gchar *name,
{
case GIMP_RUN_WITH_LAST_VALS:
case GIMP_RUN_INTERACTIVE:
- /* Possibly retrieve data */
+ /* Default settings. */
+ params.lossless = FALSE;
+ params.animation = FALSE;
+ params.loop = TRUE;
+ params.quality = 90.0f;
+ params.alpha_quality = 100.0f;
+ params.exif = TRUE;
+ params.iptc = TRUE;
+ params.xmp = TRUE;
+ params.delay = 200;
+ params.force_delay = FALSE;
+ /* Possibly override with session data */
gimp_get_data (SAVE_PROC, ¶ms);
- params.preset = g_strdup ("default"); /* can't serialize strings, so restore default */
+ /* can't serialize strings, so restore default */
+ params.preset = g_strdup ("default");
export = gimp_export_image (&image_ID, &drawable_ID, "WebP",
GIMP_EXPORT_CAN_HANDLE_RGB |
@@ -203,7 +215,6 @@ run (const gchar *name,
{
values[0].data.d_status = GIMP_PDB_CANCEL;
status = GIMP_PDB_CANCEL;
- break;
}
break;
@@ -248,7 +259,7 @@ run (const gchar *name,
if (status != GIMP_PDB_SUCCESS)
{
- g_free(params.preset);
+ g_free (params.preset);
g_free (layers);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]