From: Øyvind Kolås Date: Mon, 30 Nov 2020 04:11:18 +0000 (+0100) Subject: babl: fix bug in caching of CMYK profiles X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~6^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d8114571ba5edc1700db7a4f8798f20a54ddbe31;p=babl.git 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. --- 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) {