summaryrefslogtreecommitdiff
path: root/lcms2mt
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2019-11-21 11:20:49 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2019-11-21 11:20:49 -0800
commit7043e985298f75291e1fc25ad272140be31ffe6d (patch)
tree15bb4c00701459deba15559bc9b13c76363f7fc6 /lcms2mt
parentaa30c0798d32decfd99ff8149553221917d4301e (diff)
downloadghostpdl-7043e985298f75291e1fc25ad272140be31ffe6d.tar.gz
Ghostscript Bug 701324. Improved robustness of lcms2mt
lcmsmt will give up if it can't find the perceptual MLUT. This fix will have it check to see if the colorimetric or saturation intents are present also.
Diffstat (limited to 'lcms2mt')
-rw-r--r--lcms2mt/src/cmsio1.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lcms2mt/src/cmsio1.c b/lcms2mt/src/cmsio1.c
index f95a19be1..627f8598e 100644
--- a/lcms2mt/src/cmsio1.c
+++ b/lcms2mt/src/cmsio1.c
@@ -308,6 +308,7 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi
cmsTagTypeSignature OriginalType;
cmsTagSignature tag16;
cmsTagSignature tagFloat;
+ int k;
// On named color, take the appropriate tag
if (cmsGetDeviceClass(ContextID, hProfile) == cmsSigNamedColorClass) {
@@ -345,9 +346,17 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi
return _cmsReadFloatInputTag(ContextID, hProfile, tagFloat);
}
- // Revert to perceptual if no tag is found
+ /* There are profiles out there (not legal) that may only have a
+ colorimetric or saturation tag and no perceptual tag. If we
+ can't find the specified intent be a bit robust and not give
+ up until we can't find any table, starting with perceptual */
if (!cmsIsTag(ContextID, hProfile, tag16)) {
- tag16 = Device2PCS16[0];
+ for (k = 0; k < 3; k++) {
+ if (cmsIsTag(ContextID, hProfile, Device2PCS16[k])) {
+ tag16 = Device2PCS16[k];
+ break;
+ }
+ }
}
if (cmsIsTag(ContextID, hProfile, tag16)) { // Is there any LUT-Based table?