plug-ins/jpeg/jpeg-load.c ifdef'ed out some debugging statements so that

2007-09-19  Raphael Quinet  <raphael@gimp.org>

	* plug-ins/jpeg/jpeg-load.c
	* plug-ins/jpeg/jpeg-save.c: ifdef'ed out some debugging
	statements so that they show up only in unstable releases.

	* plug-ins/jpeg/jpeg.c (run): removed calls to gimp_set_data() and
	gimp_get_data() so that changes made to the JPEG save settings for
	one file do not affect other files saved later.

svn path=/trunk/; revision=23584
This commit is contained in:
Raphael Quinet
2007-09-19 11:44:42 +00:00
committed by Raphaël Quinet
parent dcb16bbaad
commit 51a3ee471b
4 changed files with 30 additions and 19 deletions

View File

@ -1,3 +1,13 @@
2007-09-19 Raphaël Quinet <raphael@gimp.org>
* plug-ins/jpeg/jpeg-load.c
* plug-ins/jpeg/jpeg-save.c: ifdef'ed out some debugging
statements so that they show up only in unstable releases.
* plug-ins/jpeg/jpeg.c (run): removed calls to gimp_set_data() and
gimp_get_data() so that changes made to the JPEG save settings for
one file do not affect other files saved later.
2007-09-18 Michael Natterer <mitch@gimp.org> 2007-09-18 Michael Natterer <mitch@gimp.org>
* app/gui/gtk-macmenu.[ch]: removed... * app/gui/gtk-macmenu.[ch]: removed...

View File

@ -269,8 +269,10 @@ load_image (const gchar *filename,
if (marker->marker == JPEG_COM) if (marker->marker == JPEG_COM)
{ {
#ifdef GIMP_UNSTABLE
g_print ("jpeg-load: found image comment (%d bytes)\n", g_print ("jpeg-load: found image comment (%d bytes)\n",
marker->data_length); marker->data_length);
#endif
if (! comment_buffer) if (! comment_buffer)
{ {
@ -287,8 +289,10 @@ load_image (const gchar *filename,
&& (len > sizeof (JPEG_APP_HEADER_EXIF) + 8) && (len > sizeof (JPEG_APP_HEADER_EXIF) + 8)
&& ! strcmp (JPEG_APP_HEADER_EXIF, data)) && ! strcmp (JPEG_APP_HEADER_EXIF, data))
{ {
#ifdef GIMP_UNSTABLE
g_print ("jpeg-load: found EXIF block (%d bytes)\n", g_print ("jpeg-load: found EXIF block (%d bytes)\n",
(gint) (len - sizeof (JPEG_APP_HEADER_EXIF))); (gint) (len - sizeof (JPEG_APP_HEADER_EXIF)));
#endif
#ifdef HAVE_EXIF #ifdef HAVE_EXIF
if (! exif_data) if (! exif_data)
exif_data = exif_data_new (); exif_data = exif_data_new ();
@ -338,9 +342,10 @@ load_image (const gchar *filename,
gint nreturn_vals; gint nreturn_vals;
gchar *xmp_packet; gchar *xmp_packet;
#ifdef GIMP_UNSTABLE
g_print ("jpeg-load: found XMP packet (%d bytes)\n", g_print ("jpeg-load: found XMP packet (%d bytes)\n",
(gint) (len - sizeof (JPEG_APP_HEADER_XMP))); (gint) (len - sizeof (JPEG_APP_HEADER_XMP)));
#endif
xmp_packet = g_strndup (data + sizeof (JPEG_APP_HEADER_XMP), xmp_packet = g_strndup (data + sizeof (JPEG_APP_HEADER_XMP),
len - sizeof (JPEG_APP_HEADER_XMP)); len - sizeof (JPEG_APP_HEADER_XMP));

View File

@ -563,7 +563,9 @@ save_image (const gchar *filename,
exif_data_save_data (exif_data_tmp, &exif_buf, &exif_buf_len); exif_data_save_data (exif_data_tmp, &exif_buf, &exif_buf_len);
} }
#ifdef GIMP_UNSTABLE
g_print ("jpeg-save: saving EXIF block (%d bytes)\n", exif_buf_len); g_print ("jpeg-save: saving EXIF block (%d bytes)\n", exif_buf_len);
#endif
jpeg_write_marker (&cinfo, JPEG_APP0 + 1, exif_buf, exif_buf_len); jpeg_write_marker (&cinfo, JPEG_APP0 + 1, exif_buf, exif_buf_len);
if (exif_buf) if (exif_buf)
@ -574,8 +576,10 @@ save_image (const gchar *filename,
/* Step 4.1: Write the comment out - pw */ /* Step 4.1: Write the comment out - pw */
if (image_comment && *image_comment) if (image_comment && *image_comment)
{ {
#ifdef GIMP_UNSTABLE
g_print ("jpeg-save: saving image comment (%d bytes)\n", g_print ("jpeg-save: saving image comment (%d bytes)\n",
(int) strlen (image_comment)); (int) strlen (image_comment));
#endif
jpeg_write_marker (&cinfo, JPEG_COM, jpeg_write_marker (&cinfo, JPEG_COM,
(guchar *) image_comment, strlen (image_comment)); (guchar *) image_comment, strlen (image_comment));
} }
@ -593,8 +597,10 @@ save_image (const gchar *filename,
xmp_data = ((const gchar *) gimp_parasite_data (parasite)) + 10; xmp_data = ((const gchar *) gimp_parasite_data (parasite)) + 10;
xmp_data_size = gimp_parasite_data_size (parasite) - 10; xmp_data_size = gimp_parasite_data_size (parasite) - 10;
#ifdef GIMP_UNSTABLE
g_print ("jpeg-save: saving XMP packet (%d bytes)\n", g_print ("jpeg-save: saving XMP packet (%d bytes)\n",
(int) xmp_data_size); (int) xmp_data_size);
#endif
app_block = g_malloc (sizeof (JPEG_APP_HEADER_XMP) + xmp_data_size); app_block = g_malloc (sizeof (JPEG_APP_HEADER_XMP) + xmp_data_size);
memcpy (app_block, JPEG_APP_HEADER_XMP, memcpy (app_block, JPEG_APP_HEADER_XMP,
sizeof (JPEG_APP_HEADER_XMP)); sizeof (JPEG_APP_HEADER_XMP));
@ -773,8 +779,6 @@ destroy_preview (void)
drawable_global = NULL; drawable_global = NULL;
} }
g_printerr ("destroy_preview (%d, %d)\n", preview_image_ID, preview_layer_ID);
if (gimp_image_is_valid (preview_image_ID) && if (gimp_image_is_valid (preview_image_ID) &&
gimp_drawable_is_valid (preview_layer_ID)) gimp_drawable_is_valid (preview_layer_ID))
{ {

View File

@ -393,15 +393,13 @@ run (const gchar *name,
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS: case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */ /* restore the values found when loading the file (if available) */
gimp_get_data (SAVE_PROC, &jsvals);
jpeg_restore_original_settings (orig_image_ID, jpeg_restore_original_settings (orig_image_ID,
&orig_quality, &orig_quality,
&orig_subsmp, &orig_subsmp,
&num_quant_tables); &num_quant_tables);
/* load up the previously used values */ /* load up the previously used values (if file was saved once) */
parasite = gimp_image_parasite_find (orig_image_ID, parasite = gimp_image_parasite_find (orig_image_ID,
"jpeg-save-options"); "jpeg-save-options");
if (parasite) if (parasite)
@ -441,8 +439,7 @@ run (const gchar *name,
jsvals.quality = orig_quality; jsvals.quality = orig_quality;
jsvals.use_orig_quality = TRUE; jsvals.use_orig_quality = TRUE;
} }
if (orig_subsmp == 2 if (orig_subsmp == 2 || (orig_subsmp > 0 && jsvals.subsmp == 0))
|| (orig_subsmp > 0 && jsvals.subsmp == 0))
jsvals.subsmp = orig_subsmp; jsvals.subsmp = orig_subsmp;
} }
break; break;
@ -481,16 +478,11 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ {
if (save_image (param[3].data.d_string, if (! save_image (param[3].data.d_string,
image_ID, image_ID,
drawable_ID, drawable_ID,
orig_image_ID, orig_image_ID,
FALSE)) FALSE))
{
/* Store mvals data */
gimp_set_data (SAVE_PROC, &jsvals, sizeof (JpegSaveVals));
}
else
{ {
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }