[gimp] plug-ins: ico export crashes on indexed images.



commit 42eaf588fde9d44d6b7ccd9cdb7eacfab35fe210
Author: Jehan <jehan girinstud io>
Date:   Mon Feb 5 15:00:17 2018 +0100

    plug-ins: ico export crashes on indexed images.
    
    It seems the current code simply forgot to break on indexed types and
    therefore hit some g_return_*if_reached() code breaking the logics.
    Looking further, I see some code taking care of indexed images and
    converting them to RGB. And testing after adding breaks looks like it
    works just fine.
    So I am assuming this was just forgotten breaks indeed, and not on
    purpose not allowing indexed images (if that were the intent though,
    this is not how it should be done).

 plug-ins/file-ico/ico-dialog.c |    1 +
 plug-ins/file-ico/ico-save.c   |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/file-ico/ico-dialog.c b/plug-ins/file-ico/ico-dialog.c
index 8038d0f..1667dc6 100644
--- a/plug-ins/file-ico/ico-dialog.c
+++ b/plug-ins/file-ico/ico-dialog.c
@@ -258,6 +258,7 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
     case GIMP_INDEXED_IMAGE:
     case GIMP_INDEXEDA_IMAGE:
       format = gimp_drawable_get_format (layer);
+      break;
 
     default:
       g_return_if_reached ();
diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c
index d599788..6d19e16 100644
--- a/plug-ins/file-ico/ico-save.c
+++ b/plug-ins/file-ico/ico-save.c
@@ -464,6 +464,10 @@ ico_get_layer_num_colors (gint32    layer,
     case GIMP_INDEXED_IMAGE:
     case GIMP_INDEXEDA_IMAGE:
       format = gegl_buffer_get_format (buffer);
+      /* It is possible to count the colors of indexed image more easily
+       * with gimp_image_get_colormap(), but counting only the colors
+       * actually used will allow more efficient bpp if possible. */
+      break;
 
     default:
       g_return_val_if_reached (0);
@@ -599,6 +603,7 @@ ico_image_get_reduced_buf (guint32   layer,
     case GIMP_INDEXED_IMAGE:
     case GIMP_INDEXEDA_IMAGE:
       format = gegl_buffer_get_format (buffer);
+      break;
 
     default:
       g_return_if_reached ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]