[gimp/gimp-2-8] Bug 710974 - Convert to Color profile fails on images with layer groups
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 710974 - Convert to Color profile fails on images with layer groups
- Date: Tue, 29 Oct 2013 18:41:49 +0000 (UTC)
commit 0273d0d88ae4ce76193b08311009c13e013bfc1f
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 29 19:34:38 2013 +0100
Bug 710974 - Convert to Color profile fails on images with layer groups
Handle layer groups recursively, and don't convert the group layer
itself.
(cherry picked from commit 424129cc60cc21bdea27785fbce6d2ed0908a936)
plug-ins/common/lcms.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index cbbc53e..3fa26db 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -128,6 +128,12 @@ static void lcms_image_transform_rgb (gint32 image,
cmsHPROFILE dest_profile,
GimpColorRenderingIntent intent,
gboolean bpc);
+static void lcms_layers_transform_rgb (gint *layers,
+ gint num_layers,
+ cmsHPROFILE src_profile,
+ cmsHPROFILE dest_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
static void lcms_image_transform_indexed (gint32 image,
cmsHPROFILE src_profile,
cmsHPROFILE dest_profile,
@@ -1016,18 +1022,49 @@ lcms_image_transform_rgb (gint32 image,
GimpColorRenderingIntent intent,
gboolean bpc)
{
+ gint *layers;
+ gint num_layers;
+
+ layers = gimp_image_get_layers (image, &num_layers);
+
+ lcms_layers_transform_rgb (layers, num_layers,
+ src_profile, dest_profile,
+ intent, bpc);
+
+ g_free (layers);
+}
+
+static void
+lcms_layers_transform_rgb (gint *layers,
+ gint num_layers,
+ cmsHPROFILE src_profile,
+ cmsHPROFILE dest_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
cmsHTRANSFORM transform = NULL;
cmsUInt32Number last_format = 0;
- gint *layers;
- gint num_layers;
gint i;
- layers = gimp_image_get_layers (image, &num_layers);
-
for (i = 0; i < num_layers; i++)
{
GimpDrawable *drawable = gimp_drawable_get (layers[i]);
cmsUInt32Number format;
+ gint *children;
+ gint num_children;
+
+ children = gimp_item_get_children (layers[i], &num_children);
+
+ if (children)
+ {
+ lcms_layers_transform_rgb (children, num_children,
+ src_profile, dest_profile,
+ intent, bpc);
+
+ g_free (children);
+
+ continue;
+ }
switch (drawable->bpp)
{
@@ -1073,8 +1110,6 @@ lcms_image_transform_rgb (gint32 image,
if (transform)
cmsDeleteTransform(transform);
-
- g_free (layers);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]