From f888792a773fac754ea2a38297a5a58fce0fa95a Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 11 Apr 2012 21:48:22 +0200 Subject: [PATCH] plug-ins: return image type and #layers from the JPEG thumbnail procedure --- plug-ins/file-jpeg/jpeg-load.c | 11 +++++++---- plug-ins/file-jpeg/jpeg-load.h | 9 +++++---- plug-ins/file-jpeg/jpeg.c | 18 ++++++++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c index 87267fd9d8..5ff858bea6 100644 --- a/plug-ins/file-jpeg/jpeg-load.c +++ b/plug-ins/file-jpeg/jpeg-load.c @@ -653,10 +653,11 @@ term_source (j_decompress_ptr cinfo) } gint32 -load_thumbnail_image (const gchar *filename, - gint *width, - gint *height, - GError **error) +load_thumbnail_image (const gchar *filename, + gint *width, + gint *height, + GimpImageType *type, + GError **error) { gint32 volatile image_ID; ExifData *exif_data; @@ -952,6 +953,8 @@ load_thumbnail_image (const gchar *filename, jpeg_exif_rotate (image_ID, orientation); + *type = layer_type; + return image_ID; } diff --git a/plug-ins/file-jpeg/jpeg-load.h b/plug-ins/file-jpeg/jpeg-load.h index 1225d7efad..fe38c41c24 100644 --- a/plug-ins/file-jpeg/jpeg-load.h +++ b/plug-ins/file-jpeg/jpeg-load.h @@ -26,10 +26,11 @@ gint32 load_image (const gchar *filename, #ifdef HAVE_LIBEXIF -gint32 load_thumbnail_image (const gchar *filename, - gint *width, - gint *height, - GError **error); +gint32 load_thumbnail_image (const gchar *filename, + gint *width, + gint *height, + GimpImageType *type, + GError **error); #endif /* HAVE_LIBEXIF */ diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c index 9f0d06908e..8afe283f00 100644 --- a/plug-ins/file-jpeg/jpeg.c +++ b/plug-ins/file-jpeg/jpeg.c @@ -191,7 +191,7 @@ run (const gchar *name, gint *nreturn_vals, GimpParam **return_vals) { - static GimpParam values[4]; + static GimpParam values[6]; GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; gint32 image_ID; @@ -257,21 +257,27 @@ run (const gchar *name, } else { - const gchar *filename = param[0].data.d_string; - gint width = 0; - gint height = 0; + const gchar *filename = param[0].data.d_string; + gint width = 0; + gint height = 0; + GimpImageType type = -1; - image_ID = load_thumbnail_image (filename, &width, &height, &error); + image_ID = load_thumbnail_image (filename, &width, &height, &type, + &error); if (image_ID != -1) { - *nreturn_vals = 4; + *nreturn_vals = 6; values[1].type = GIMP_PDB_IMAGE; values[1].data.d_image = image_ID; values[2].type = GIMP_PDB_INT32; values[2].data.d_int32 = width; values[3].type = GIMP_PDB_INT32; values[3].data.d_int32 = height; + values[4].type = GIMP_PDB_INT32; + values[4].data.d_int32 = type; + values[5].type = GIMP_PDB_INT32; + values[5].data.d_int32 = 1; /* num_layers */ } else {