summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-21 14:18:08 +0100
committerSam James <sam@gentoo.org>2022-10-02 04:31:25 +0100
commita529111f77ff46f4836fe7312e70953bc16587cf (patch)
tree9dc3924cb1a6ef3ef853b7bb45f735365e0b4e6d /lcms2mt
parentImport Ghostscript 9.56.1 (diff)
downloadghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.tar.gz
ghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.tar.bz2
ghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.zip
Import Ghostscript 10.0ghostscript-10.0ghostscript-10
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'lcms2mt')
-rw-r--r--lcms2mt/src/cmsvirt.c2
-rw-r--r--lcms2mt/src/cmsxform.c30
-rw-r--r--lcms2mt/src/lcms2_internal.h2
3 files changed, 21 insertions, 13 deletions
diff --git a/lcms2mt/src/cmsvirt.c b/lcms2mt/src/cmsvirt.c
index 6c0890f5..f85aa5d1 100644
--- a/lcms2mt/src/cmsvirt.c
+++ b/lcms2mt/src/cmsvirt.c
@@ -937,7 +937,7 @@ cmsHPROFILE CreateNamedColorDevicelink(cmsContext ContextID, cmsHTRANSFORM xform
v ->OutputFormat = OutputFormat;
v ->FromInput = FromInput;
v ->ToOutput = ToOutput;
- _cmsFindFormatter(v, InputFormat, OutputFormat, v->core->dwOriginalFlags);
+ _cmsFindFormatter(ContextID, v, InputFormat, OutputFormat, v->core->dwOriginalFlags);
// Apply the transfor to colorants.
for (i=0; i < nColors; i++) {
diff --git a/lcms2mt/src/cmsxform.c b/lcms2mt/src/cmsxform.c
index 7f4e1589..e3ede6ba 100644
--- a/lcms2mt/src/cmsxform.c
+++ b/lcms2mt/src/cmsxform.c
@@ -26,6 +26,10 @@
#include "lcms2_internal.h"
+#ifdef WITH_CAL
+#include "cal_cms.h"
+#endif
+
// Transformations stuff
// -----------------------------------------------------------------------
@@ -1939,18 +1943,20 @@ cmsUInt32Number CMSEXPORT _cmsGetTransformFlags(struct _cmstransform_struct* CMM
}
void
-_cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number OutputFormat, cmsUInt32Number dwFlags)
+_cmsFindFormatter(cmsContext ContextID, _cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number OutputFormat, cmsUInt32Number dwFlags)
{
+ int isIdentity;
if (dwFlags & cmsFLAGS_NULLTRANSFORM) {
p ->xform = NullXFORM;
return;
}
+ isIdentity = ((InputFormat & ~COLORSPACE_SH(31)) == (OutputFormat & ~COLORSPACE_SH(31)) &&
+ _cmsLutIsIdentity(p->core->Lut));
if (dwFlags & cmsFLAGS_PREMULT) {
if (dwFlags & cmsFLAGS_NOCACHE) {
if (dwFlags & cmsFLAGS_GAMUTCHECK)
p ->xform = PrecalculatedXFORMGamutCheck_P; // Gamut check, no cache
- else if ((InputFormat & ~COLORSPACE_SH(31)) == (OutputFormat & ~COLORSPACE_SH(31)) &&
- _cmsLutIsIdentity(p->core->Lut)) {
+ else if (isIdentity) {
if (T_PLANAR(InputFormat))
p ->xform = PrecalculatedXFORMIdentityPlanar;
else
@@ -1963,8 +1969,7 @@ _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number
p ->xform = CachedXFORMGamutCheck_P; // Gamut check, cache
return;
}
- if ((InputFormat & ~COLORSPACE_SH(31)) == (OutputFormat & ~COLORSPACE_SH(31)) &&
- _cmsLutIsIdentity(p->core->Lut)) {
+ if (isIdentity) {
/* No point in a cache here! */
if (T_PLANAR(InputFormat))
p ->xform = PrecalculatedXFORMIdentityPlanar;
@@ -1976,8 +1981,7 @@ _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number
if (dwFlags & cmsFLAGS_NOCACHE) {
if (dwFlags & cmsFLAGS_GAMUTCHECK)
p ->xform = PrecalculatedXFORMGamutCheck; // Gamut check, no cache
- else if ((InputFormat & ~COLORSPACE_SH(31)) == (OutputFormat & ~COLORSPACE_SH(31)) &&
- _cmsLutIsIdentity(p->core->Lut)) {
+ else if (isIdentity) {
if (T_PLANAR(InputFormat))
p ->xform = PrecalculatedXFORMIdentityPlanar;
else
@@ -1990,8 +1994,7 @@ _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number
p ->xform = CachedXFORMGamutCheck; // Gamut check, cache
return;
}
- if ((InputFormat & ~COLORSPACE_SH(31)) == (OutputFormat & ~COLORSPACE_SH(31)) &&
- _cmsLutIsIdentity(p->core->Lut)) {
+ if (isIdentity) {
/* No point in a cache here! */
if (T_PLANAR(InputFormat))
p ->xform = PrecalculatedXFORMIdentityPlanar;
@@ -1999,6 +2002,11 @@ _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number
p ->xform = PrecalculatedXFORMIdentity;
return;
}
+#ifdef WITH_CAL
+ if (cal_cms_find_formatter_and_xform(ContextID, &p->xform, InputFormat, OutputFormat, &dwFlags)) {
+ return;
+ }
+#endif
if (T_EXTRA(InputFormat) == 1 && T_EXTRA(OutputFormat) == 1) {
if (dwFlags & cmsFLAGS_PREMULT) {
if ((InputFormat & ~(COLORSPACE_SH(31)|CHANNELS_SH(7)|BYTES_SH(3)|EXTRA_SH(1))) == 0 &&
@@ -2329,7 +2337,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
}
- _cmsFindFormatter(p, *InputFormat, *OutputFormat, *dwFlags);
+ _cmsFindFormatter(ContextID, p, *InputFormat, *OutputFormat, *dwFlags);
}
p ->InputFormat = *InputFormat;
@@ -2745,7 +2753,7 @@ cmsHTRANSFORM cmsCloneTransformChangingFormats(cmsContext ContextID,
xform ->OutputFormat = OutputFormat;
xform ->FromInput = FromInput;
xform ->ToOutput = ToOutput;
- _cmsFindFormatter(xform, InputFormat, OutputFormat, xform->core->dwOriginalFlags);
+ _cmsFindFormatter(ContextID, xform, InputFormat, OutputFormat, xform->core->dwOriginalFlags);
(void)_cmsAdjustReferenceCount(&xform->core->refs, 1);
diff --git a/lcms2mt/src/lcms2_internal.h b/lcms2mt/src/lcms2_internal.h
index 504393e2..97dcbc4d 100644
--- a/lcms2mt/src/lcms2_internal.h
+++ b/lcms2mt/src/lcms2_internal.h
@@ -1116,7 +1116,7 @@ cmsBool _cmsAdaptationMatrix(cmsContext ContextID, cmsMAT3* r, const cmsMAT3*
cmsBool _cmsBuildRGB2XYZtransferMatrix(cmsContext ContextID, cmsMAT3* r, const cmsCIExyY* WhitePoint, const cmsCIExyYTRIPLE* Primaries);
-void _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number OutputFormat, cmsUInt32Number flags);
+void _cmsFindFormatter(cmsContext ContextID, _cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number OutputFormat, cmsUInt32Number flags);
cmsUInt32Number _cmsAdjustReferenceCount(cmsUInt32Number *rc, int delta);