[gimp] plug-ins: minor cleanups in file-jpeg, no porting to new stuff yet
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: minor cleanups in file-jpeg, no porting to new stuff yet
- Date: Wed, 23 Oct 2019 17:14:36 +0000 (UTC)
commit 991703a7eedcebe93f1022166168a7352219c775
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 20 14:32:02 2019 +0200
plug-ins: minor cleanups in file-jpeg, no porting to new stuff yet
plug-ins/file-jpeg/jpeg-save.c | 4 +-
plug-ins/file-jpeg/jpeg-save.h | 14 +++---
plug-ins/file-jpeg/jpeg.c | 107 ++++++++++++++++++-----------------------
3 files changed, 57 insertions(+), 68 deletions(-)
---
diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c
index 87e967d8cb..d9ce9d0664 100644
--- a/plug-ins/file-jpeg/jpeg-save.c
+++ b/plug-ins/file-jpeg/jpeg-save.c
@@ -809,7 +809,7 @@ toggle_arithmetic_coding (GtkToggleButton *togglebutton,
}
gboolean
-save_dialog (void)
+save_dialog (GimpDrawable *drawable)
{
JpegSaveGui pg;
GtkWidget *dialog;
@@ -1196,7 +1196,7 @@ save_dialog (void)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
- if (gimp_drawable_is_rgb (drawable_global))
+ if (gimp_drawable_is_rgb (drawable))
{
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
jsvals.subsmp,
diff --git a/plug-ins/file-jpeg/jpeg-save.h b/plug-ins/file-jpeg/jpeg-save.h
index c2f129b7ba..c5fd590ffe 100644
--- a/plug-ins/file-jpeg/jpeg-save.h
+++ b/plug-ins/file-jpeg/jpeg-save.h
@@ -44,13 +44,13 @@ extern GimpImage *orig_image_global;
extern GimpDrawable *drawable_global;
-gboolean save_image (GFile *file,
- GimpImage *image,
- GimpDrawable *drawable,
- GimpImage *orig_image,
- gboolean preview,
- GError **error);
-gboolean save_dialog (void);
+gboolean save_image (GFile *file,
+ GimpImage *image,
+ GimpDrawable *drawable,
+ GimpImage *orig_image,
+ gboolean preview,
+ GError **error);
+gboolean save_dialog (GimpDrawable *drawable);
void load_defaults (void);
void load_parasite (void);
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 987477d3db..6e8df59a66 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -56,25 +56,25 @@ GType jpeg_get_type (void) G_GNUC_CONST;
static GList * jpeg_query_procedures (GimpPlugIn *plug_in);
static GimpProcedure * jpeg_create_procedure (GimpPlugIn *plug_in,
- const gchar *name);
+ const gchar *name);
static GimpValueArray * jpeg_load (GimpProcedure *procedure,
- GimpRunMode run_mode,
- GFile *file,
- const GimpValueArray *args,
- gpointer run_data);
+ GimpRunMode run_mode,
+ GFile *file,
+ const GimpValueArray *args,
+ gpointer run_data);
static GimpValueArray * jpeg_load_thumb (GimpProcedure *procedure,
- GFile *file,
- gint size,
- const GimpValueArray *args,
- gpointer run_data);
+ GFile *file,
+ gint size,
+ const GimpValueArray *args,
+ gpointer run_data);
static GimpValueArray * jpeg_save (GimpProcedure *procedure,
- GimpRunMode run_mode,
- GimpImage *image,
- GimpDrawable *drawable,
- GFile *file,
- const GimpValueArray *args,
- gpointer run_data);
+ GimpRunMode run_mode,
+ GimpImage *image,
+ GimpDrawable *drawable,
+ GFile *file,
+ const GimpValueArray *args,
+ gpointer run_data);
G_DEFINE_TYPE (Jpeg, jpeg, GIMP_TYPE_PLUG_IN)
@@ -82,16 +82,15 @@ G_DEFINE_TYPE (Jpeg, jpeg, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (JPEG_TYPE)
-gboolean undo_touched;
-gboolean load_interactive;
-gchar *image_comment;
-GimpDisplay *display;
-JpegSaveVals jsvals;
-GimpImage *orig_image_global;
-GimpDrawable *drawable_global;
-gint orig_quality;
-JpegSubsampling orig_subsmp;
-gint num_quant_tables;
+gboolean undo_touched = FALSE;
+gchar *image_comment = NULL;
+GimpDisplay *display = NULL;
+JpegSaveVals jsvals = { 0, };
+GimpImage *orig_image_global = NULL;
+GimpDrawable *drawable_global = NULL;
+gint orig_quality = 0;
+JpegSubsampling orig_subsmp = JPEG_SUBSAMPLING_2x2_1x1_1x1;;
+gint num_quant_tables = 0;
static void
@@ -122,7 +121,7 @@ jpeg_query_procedures (GimpPlugIn *plug_in)
static GimpProcedure *
jpeg_create_procedure (GimpPlugIn *plug_in,
- const gchar *name)
+ const gchar *name)
{
GimpProcedure *procedure = NULL;
@@ -196,6 +195,9 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"jpg,jpeg,jpe");
+ /* See bugs #63610 and #61088 for a discussion about the quality
+ * settings
+ */
GIMP_PROC_ARG_DOUBLE (procedure, "quality",
"Quality",
"Quality of saved image",
@@ -253,9 +255,7 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
GIMP_PROC_ARG_INT (procedure, "dct",
"DCT",
- "DCT method to use { "
- "INTEGER (0), "
- "FIXED (1), "
+ "DCT method to use { INTEGER (0), FIXED (1), "
"FLOAT (2) }",
0, 2, 0,
G_PARAM_READWRITE);
@@ -266,13 +266,14 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray *
jpeg_load (GimpProcedure *procedure,
- GimpRunMode run_mode,
- GFile *file,
- const GimpValueArray *args,
- gpointer run_data)
+ GimpRunMode run_mode,
+ GFile *file,
+ const GimpValueArray *args,
+ gpointer run_data)
{
GimpValueArray *return_vals;
GimpImage *image;
+ gboolean interactive;
gboolean resolution_loaded = FALSE;
GError *error = NULL;
@@ -282,20 +283,16 @@ jpeg_load (GimpProcedure *procedure,
preview_image = NULL;
preview_layer = NULL;
- orig_quality = 0;
- orig_subsmp = JPEG_SUBSAMPLING_2x2_1x1_1x1;
- num_quant_tables = 0;
-
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
- load_interactive = TRUE;
+ interactive = TRUE;
break;
default:
- load_interactive = FALSE;
+ interactive = FALSE;
break;
}
@@ -318,7 +315,7 @@ jpeg_load (GimpProcedure *procedure,
gimp_image_metadata_load_finish (image, "image/jpeg",
metadata, flags,
- load_interactive);
+ interactive);
g_object_unref (metadata);
}
@@ -340,10 +337,10 @@ jpeg_load (GimpProcedure *procedure,
static GimpValueArray *
jpeg_load_thumb (GimpProcedure *procedure,
- GFile *file,
- gint size,
- const GimpValueArray *args,
- gpointer run_data)
+ GFile *file,
+ gint size,
+ const GimpValueArray *args,
+ gpointer run_data)
{
GimpValueArray *return_vals;
GimpImage *image;
@@ -358,10 +355,6 @@ jpeg_load_thumb (GimpProcedure *procedure,
preview_image = NULL;
preview_layer = NULL;
- orig_quality = 0;
- orig_subsmp = JPEG_SUBSAMPLING_2x2_1x1_1x1;
- num_quant_tables = 0;
-
image = load_thumbnail_image (file, &width, &height, &type,
&error);
@@ -386,12 +379,12 @@ jpeg_load_thumb (GimpProcedure *procedure,
static GimpValueArray *
jpeg_save (GimpProcedure *procedure,
- GimpRunMode run_mode,
- GimpImage *image,
- GimpDrawable *drawable,
- GFile *file,
- const GimpValueArray *args,
- gpointer run_data)
+ GimpRunMode run_mode,
+ GimpImage *image,
+ GimpDrawable *drawable,
+ GFile *file,
+ const GimpValueArray *args,
+ gpointer run_data)
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpParasite *parasite;
@@ -407,10 +400,6 @@ jpeg_save (GimpProcedure *procedure,
preview_image = NULL;
preview_layer = NULL;
- orig_quality = 0;
- orig_subsmp = JPEG_SUBSAMPLING_2x2_1x1_1x1;
- num_quant_tables = 0;
-
orig_image = image;
switch (run_mode)
@@ -582,7 +571,7 @@ jpeg_save (GimpProcedure *procedure,
drawable_global = drawable;
/* First acquire information with a dialog */
- if (! save_dialog ())
+ if (! save_dialog (drawable))
{
status = GIMP_PDB_CANCEL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]