[gimp] Bug 723392 - Pasting an image replaces color profile with default one
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 723392 - Pasting an image replaces color profile with default one
- Date: Sat, 15 Aug 2015 17:16:18 +0000 (UTC)
commit b5264ec1beee54a884ce5c76c702431eee6aa9e2
Author: Michael Natterer <mitch gimp org>
Date: Sat Aug 15 19:15:14 2015 +0200
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.
app/core/gimp-edit.c | 16 +++++++++-------
app/core/gimpbuffer.c | 10 ++++++++++
app/core/gimplayer-new.c | 10 ++++++++++
3 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 1d49316..e08ffe3 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -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;
diff --git a/app/core/gimpbuffer.c b/app/core/gimpbuffer.c
index 59c60e5..cbe61b3 100644
--- a/app/core/gimpbuffer.c
+++ b/app/core/gimpbuffer.c
@@ -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);
diff --git a/app/core/gimplayer-new.c b/app/core/gimplayer-new.c
index 030f3b1..e9d6057 100644
--- a/app/core/gimplayer-new.c
+++ b/app/core/gimplayer-new.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]