[gimp] Bug 648820 - drag and drop grayscale/greyscale image causes image corruption



commit 69d3aa5b36a2bd451da816fd1bb7c5f2a2e15ee9
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 28 01:44:48 2011 +0200

    Bug 648820 - drag and drop grayscale/greyscale image causes image corruption
    
    gimp_display_shell_drop_pixbuf(): use the image's type to create the
    layer, not the dropped pixbuf's.

 app/display/gimpdisplayshell-dnd.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 63b1f47..504f3a0 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -639,17 +639,12 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
       return;
     }
 
-  switch (gdk_pixbuf_get_n_channels (pixbuf))
+  image_type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
+
+  if (gdk_pixbuf_get_n_channels (pixbuf) == 2 ||
+      gdk_pixbuf_get_n_channels (pixbuf) == 4)
     {
-    case 1: image_type = GIMP_GRAY_IMAGE;  break;
-    case 2: image_type = GIMP_GRAYA_IMAGE; break;
-    case 3: image_type = GIMP_RGB_IMAGE;   break;
-    case 4: image_type = GIMP_RGBA_IMAGE;  break;
-      break;
-
-    default:
-      g_return_if_reached ();
-      break;
+      image_type = GIMP_IMAGE_TYPE_WITH_ALPHA (image_type);
     }
 
   new_layer =



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