app: transfer the right profile in gimp_image_new_from_drawable()

Use the drawable's profile not the image's.
This commit is contained in:
Michael Natterer 2016-05-03 12:51:52 +02:00
parent f1f91ecc2f
commit 58f8808847
1 changed files with 7 additions and 12 deletions

View File

@ -165,6 +165,7 @@ gimp_image_new_from_drawable (Gimp *gimp,
GimpImageBaseType type;
gdouble xres;
gdouble yres;
GimpColorProfile *profile;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -192,17 +193,13 @@ gimp_image_new_from_drawable (Gimp *gimp,
gimp_image_set_resolution (new_image, xres, yres);
gimp_image_set_unit (new_image, gimp_image_get_unit (image));
if (GIMP_IS_LAYER (drawable))
{
GimpColorProfile *profile = gimp_image_get_color_profile (image);
gimp_image_set_color_profile (new_image, profile, NULL);
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
gimp_image_set_color_profile (new_image, profile, NULL);
new_type = G_TYPE_FROM_INSTANCE (drawable);
}
if (GIMP_IS_LAYER (drawable))
new_type = G_TYPE_FROM_INSTANCE (drawable);
else
{
new_type = GIMP_TYPE_LAYER;
}
new_type = GIMP_TYPE_LAYER;
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (drawable),
new_image, new_type));
@ -289,7 +286,6 @@ gimp_image_new_from_buffer (Gimp *gimp,
format = gimp_buffer_get_format (paste);
has_alpha = babl_format_has_alpha (format);
/* create a new image (always of type GIMP_RGB) */
image = gimp_create_image (gimp,
gimp_buffer_get_width (paste),
gimp_buffer_get_height (paste),
@ -309,8 +305,7 @@ gimp_image_new_from_buffer (Gimp *gimp,
}
profile = gimp_buffer_get_color_profile (paste);
if (profile)
gimp_image_set_color_profile (image, profile, NULL);
gimp_image_set_color_profile (image, profile, NULL);
layer = gimp_layer_new_from_buffer (paste, image,
gimp_image_get_layer_format (image,