Bug 723392 - Pasting an image replaces color profile with default one

Make sure that paste buffers are always tagged with a profile. This
should fix copy and paste between gamma and linear images.
This commit is contained in:
Michael Natterer 2015-08-15 19:15:14 +02:00
parent 9cf455f915
commit b5264ec1be
3 changed files with 29 additions and 7 deletions

View File

@ -612,15 +612,17 @@ gimp_edit_extract (GimpImage *image,
if (GIMP_IS_LAYER (pickable) ||
GIMP_IS_IMAGE (pickable))
{
const guint8 *icc_data;
gsize icc_len;
GimpColorProfile *profile;
const guint8 *icc_data;
gsize icc_len;
icc_data =
gimp_color_managed_get_icc_profile (GIMP_COLOR_MANAGED (image),
&icc_len);
profile =
gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
if (icc_data)
gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
g_object_unref (profile);
}
return gimp_buffer;

View File

@ -289,6 +289,16 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
g_free (icc_data);
}
else if (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
{
GimpColorProfile *profile = gimp_color_profile_new_srgb ();
const guint8 *icc_data;
icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
g_object_unref (profile);
}
g_object_unref (buffer);

View File

@ -218,6 +218,16 @@ gimp_layer_new_from_pixbuf (GdkPixbuf *pixbuf,
gimp_layer_new_convert_profile (layer, buffer, icc_data, icc_len, NULL);
g_free (icc_data);
}
else if (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
{
GimpColorProfile *profile = gimp_color_profile_new_srgb ();
const guint8 *icc_data;
icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
gimp_layer_new_convert_profile (layer, buffer, icc_data, icc_len, NULL);
g_object_unref (profile);
}
else
{
gegl_buffer_copy (buffer, NULL, GEGL_ABYSS_NONE,