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.
This commit is contained in:
Michael Natterer 2011-04-28 01:44:48 +02:00
parent 92ce59e1c1
commit 69d3aa5b36
1 changed files with 5 additions and 10 deletions

View File

@ -639,17 +639,12 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
return;
}
switch (gdk_pixbuf_get_n_channels (pixbuf))
{
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;
image_type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
default:
g_return_if_reached ();
break;
if (gdk_pixbuf_get_n_channels (pixbuf) == 2 ||
gdk_pixbuf_get_n_channels (pixbuf) == 4)
{
image_type = GIMP_IMAGE_TYPE_WITH_ALPHA (image_type);
}
new_layer =