diff options
author | Marti Maria <marti.maria@littlecms.com> | 2020-06-05 19:36:39 +0200 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2020-06-05 19:36:39 +0200 |
commit | 7a13d5b9db93e782026e1de8ed296461ba2a4b0d (patch) | |
tree | 39d755aa9568c67e33d8472036fe47090921f1f3 /src/cmsxform.c | |
parent | 0a27fbb19d20428aa53761dff296472ee141511f (diff) | |
download | lcms2-7a13d5b9db93e782026e1de8ed296461ba2a4b0d.tar.gz |
Fix slight change of behaviour on create transformslcms2.10A
in 2.10 cmsFLAGS_NOOPTIMIZE changed slightly the previous behaviour as prevented any kind of optimization.
That was enough to crash some complex workflows of cerain apps,, so here is a rollback.
Diffstat (limited to 'src/cmsxform.c')
-rw-r--r-- | src/cmsxform.c | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/src/cmsxform.c b/src/cmsxform.c index ee9f2c3..5a90306 100644 --- a/src/cmsxform.c +++ b/src/cmsxform.c @@ -795,45 +795,48 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, p->Lut = lut; // Let's see if any plug-in want to do the transform by itself - if (p->Lut != NULL && !(*dwFlags & cmsFLAGS_NOOPTIMIZE)) { - - for (Plugin = ctx->TransformCollection; - Plugin != NULL; - Plugin = Plugin->Next) { - - if (Plugin->Factory(&p->xform, &p->UserData, &p->FreeUserData, &p->Lut, InputFormat, OutputFormat, dwFlags)) { - - // Last plugin in the declaration order takes control. We just keep - // the original parameters as a logging. - // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default - // an optimized transform is not reusable. The plug-in can, however, change - // the flags and make it suitable. - - p->ContextID = ContextID; - p->InputFormat = *InputFormat; - p->OutputFormat = *OutputFormat; - p->dwOriginalFlags = *dwFlags; - - // Fill the formatters just in case the optimized routine is interested. - // No error is thrown if the formatter doesn't exist. It is up to the optimization - // factory to decide what to do in those cases. - p->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; - p->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; - p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; - p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; - - // Save the day? (Ignore the warning) - if (Plugin->OldXform) { - p->OldXform = (_cmsTransformFn)(void*) p->xform; - p->xform = _cmsTransform2toTransformAdaptor; - } - - return p; - } - } - - // Not suitable for the transform plug-in, let's check the pipeline plug-in - _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags); + if (p->Lut != NULL) { + + if (!(*dwFlags & cmsFLAGS_NOOPTIMIZE)) + { + for (Plugin = ctx->TransformCollection; + Plugin != NULL; + Plugin = Plugin->Next) { + + if (Plugin->Factory(&p->xform, &p->UserData, &p->FreeUserData, &p->Lut, InputFormat, OutputFormat, dwFlags)) { + + // Last plugin in the declaration order takes control. We just keep + // the original parameters as a logging. + // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default + // an optimized transform is not reusable. The plug-in can, however, change + // the flags and make it suitable. + + p->ContextID = ContextID; + p->InputFormat = *InputFormat; + p->OutputFormat = *OutputFormat; + p->dwOriginalFlags = *dwFlags; + + // Fill the formatters just in case the optimized routine is interested. + // No error is thrown if the formatter doesn't exist. It is up to the optimization + // factory to decide what to do in those cases. + p->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; + p->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; + p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + + // Save the day? (Ignore the warning) + if (Plugin->OldXform) { + p->OldXform = (_cmsTransformFn)(void*)p->xform; + p->xform = _cmsTransform2toTransformAdaptor; + } + + return p; + } + } + } + + // Not suitable for the transform plug-in, let's check the pipeline plug-in + _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags); } // Check whatever this is a true floating point transform |