From d8114571ba5edc1700db7a4f8798f20a54ddbe31 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 30 Nov 2020 05:11:18 +0100 Subject: [PATCH] babl: fix bug in caching of CMYK profiles The check for duplicates was gumming up the CMYK profile initialization, causing babl internal CMYK to be used instead and the original icc profile to be lost. --- babl/babl-icc.c | 6 +++--- babl/babl-space.c | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/babl/babl-icc.c b/babl/babl-icc.c index 7d1fd67..a032746 100644 --- a/babl/babl-icc.c +++ b/babl/babl-icc.c @@ -967,6 +967,8 @@ babl_space_from_icc (const char *icc_data, if (!strcmp (color_space.str, "CMYK")) { ret = _babl_space_for_lcms (icc_data, icc_length); + if (!ret) + return NULL; if (ret->space.icc_type == BablICCTypeCMYK) return ret; ret->space.icc_length = icc_length; @@ -1002,12 +1004,10 @@ babl_space_from_icc (const char *icc_data, // INTENT_PERCEPTUAL,0);//intent & 7, 0); cmsCloseProfile (ret->space.cmyk.lcms_profile); // XXX keep it open in case of CMYK to CMYK transforms needed? #endif + ret->space.icc_type = BablICCTypeCMYK; return ret; } - - - if (strcmp (color_space.str, "RGB ") && strcmp (color_space.str, "GRAY") ) diff --git a/babl/babl-space.c b/babl/babl-space.c index c662629..282d728 100644 --- a/babl/babl-space.c +++ b/babl/babl-space.c @@ -244,7 +244,6 @@ _babl_space_for_lcms (const char *icc_data, memset (&space, 0, sizeof(space)); space.instance.class_type = BABL_SPACE; space.instance.id = 0; - space.icc_type = BablICCTypeCMYK; if (i >= MAX_SPACES-1) { -- 2.30.2