From 2a85dd08a9010ef4c2b1569f184941a24f103af1 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 19 Jul 2022 22:44:58 +0200 Subject: [PATCH] =?UTF-8?q?plug-ins:=20replace=20gimp=5Fimage=5Fget=5Facti?= =?UTF-8?q?ve=5Fdrawable()=20by=20newer=20function=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … gimp_image_get_selected_drawables(). --- plug-ins/common/file-pdf-save.c | 13 ++++++++++--- plug-ins/common/file-ps.c | 14 ++++++++------ plug-ins/file-dds/ddswrite.c | 14 ++++++++------ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c index 589793b84e..45387e83e6 100644 --- a/plug-ins/common/file-pdf-save.c +++ b/plug-ins/common/file-pdf-save.c @@ -779,14 +779,21 @@ pdf_save_image (GimpProcedure *procedure, gdouble x_scale, y_scale; GimpDrawable **temp; GimpDrawable **temp_out; + GimpItem **drawables; + gint n_drawables; gint temp_size = 1; gint j; - if (! gimp_image_get_active_drawable (image)) - continue; + drawables = gimp_image_get_selected_drawables (image, &n_drawables); + if (n_drawables == 0) + { + g_free (drawables); + continue; + } temp = g_new (GimpDrawable *, 1); - temp[0] = gimp_image_get_active_drawable (image); + temp[0] = GIMP_DRAWABLE (drawables[0]); + g_free (drawables); temp_out = temp; /* Save the state of the surface before any changes, so that diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c index 06e11dfc7e..6cd95640fc 100644 --- a/plug-ins/common/file-ps.c +++ b/plug-ins/common/file-ps.c @@ -1284,19 +1284,21 @@ load_image (GFile *file, } else { - GimpLayer *current_layer; - GimpDrawable *tmp_drawable; - gchar *name; + GimpLayer *current_layer; + gchar *name; + GimpDrawable **tmp_drawables; + gint n_drawables; - tmp_drawable = gimp_image_get_active_drawable (image_list[k]); + tmp_drawables = gimp_image_get_selected_drawables (image_list[k], &n_drawables); - name = gimp_item_get_name (GIMP_ITEM (tmp_drawable)); + name = gimp_item_get_name (GIMP_ITEM (tmp_drawables[0])); - current_layer = gimp_layer_new_from_drawable (tmp_drawable, image); + current_layer = gimp_layer_new_from_drawable (tmp_drawables[0], image); gimp_item_set_name (GIMP_ITEM (current_layer), name); gimp_image_insert_layer (image, current_layer, NULL, -1); gimp_image_delete (image_list[k]); + g_free (tmp_drawables); g_free (name); } } diff --git a/plug-ins/file-dds/ddswrite.c b/plug-ins/file-dds/ddswrite.c index 8adea55922..9ab3765fa8 100644 --- a/plug-ins/file-dds/ddswrite.c +++ b/plug-ins/file-dds/ddswrite.c @@ -585,9 +585,14 @@ write_dds (GFile *file, */ if (! is_duplicate_image) { - GimpImage *duplicate_image = gimp_image_duplicate (image); - rc = write_image (fp, duplicate_image, drawable, config); + GimpImage *duplicate_image = gimp_image_duplicate (image); + GimpItem **drawables; + gint n_drawables; + + drawables = gimp_image_get_selected_drawables (duplicate_image, &n_drawables); + rc = write_image (fp, duplicate_image, GIMP_DRAWABLE (drawables[0]), config); gimp_image_delete (duplicate_image); + g_free (drawables); } else { @@ -1355,10 +1360,7 @@ write_image (FILE *fp, NULL); if (flip_export) - { - gimp_image_flip (image, GIMP_ORIENTATION_VERTICAL); - drawable = gimp_image_get_active_drawable (image); - } + gimp_image_flip (image, GIMP_ORIENTATION_VERTICAL); layers = gimp_image_list_layers (image); num_layers = g_list_length (layers);