diff --git a/src/cmsxform.c b/src/cmsxform.c index f09ef7d1..7219c8b9 100644 --- a/src/cmsxform.c +++ b/src/cmsxform.c @@ -293,9 +293,11 @@ void FloatXFORM(_cmsTRANSFORM* p, // Is current color out of gamut? if (OutOfGamut > 0.0) { + _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*)_cmsContextGetClientChunk(p->ContextID, AlarmCodesContext); + // Certainly, out of gamut for (c = 0; c < cmsMAXCHANNELS; c++) - fOut[c] = 1.0; + fOut[c] = ContextAlarmCodes->AlarmCodes[c] / 65535.0; } else { diff --git a/testbed/testcms2.c b/testbed/testcms2.c index 5d97cca4..7fe78fbd 100644 --- a/testbed/testcms2.c +++ b/testbed/testcms2.c @@ -8828,6 +8828,10 @@ int CheckSaveLinearizationDevicelink(void) static int CheckGamutCheckFloats(void) { + + cmsUInt16Number alarms[16] = { 0x0f0f,3,4,5,6,7,8,9,10 }; + + cmsHPROFILE hLab = cmsCreateLab4Profile(NULL); cmsHPROFILE hNull = cmsCreateNULLProfile(); cmsHPROFILE hsRGB = cmsCreate_sRGBProfile(); @@ -8845,9 +8849,12 @@ int CheckGamutCheckFloats(void) cmsCIELab Lab2 = { 50, -10, 12 }; cmsUInt8Number gamut; + + cmsSetAlarmCodes(alarms); + cmsDoTransform(xfrm, &Lab, &gamut, 1); // Gives the alarm != 0 - if (gamut == 0) - Fail("Gamut check not zero"); + if (gamut != 0x0f) + Fail("Gamut check not good"); cmsDoTransform(xfrm, &Lab2, &gamut, 1); if (gamut != 0)