[gimp] app: transfer the right profile in gimp_image_new_from_drawable()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: transfer the right profile in gimp_image_new_from_drawable()
- Date: Tue, 3 May 2016 10:52:32 +0000 (UTC)
commit 58f8808847ba68ca9e17152565bcc5b5e1c37ba4
Author: Michael Natterer <mitch gimp org>
Date: Tue May 3 12:51:52 2016 +0200
app: transfer the right profile in gimp_image_new_from_drawable()
Use the drawable's profile not the image's.
app/core/gimpimage-new.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 5fd1648..da37d32 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]