@@ -184,15 +184,15 @@ void BuildColorSpaceOps(OpRcPtrVec & ops,
184184
185185 if (!src)
186186 {
187- srcNamedTransform = config.getNamedTransform (srcName.c_str ());
187+ srcNamedTransform = config.getNamedTransform ( context-> resolveStringVar ( srcName.c_str ()) );
188188 if (!srcNamedTransform)
189189 {
190190 ThrowMissingCS (srcName.c_str ());
191191 }
192192 }
193193 if (!dst)
194194 {
195- dstNamedTransform = config.getNamedTransform (dstName.c_str ());
195+ dstNamedTransform = config.getNamedTransform ( context-> resolveStringVar ( dstName.c_str ()) );
196196 if (!dstNamedTransform)
197197 {
198198 ThrowMissingCS (dstName.c_str ());
@@ -393,6 +393,31 @@ void BuildReferenceConversionOps(OpRcPtrVec & ops,
393393 }
394394}
395395
396+ bool CollectContextVariables (const Config & config,
397+ const Context & context,
398+ ConstNamedTransformRcPtr & nt,
399+ ContextRcPtr & usedContextVars)
400+ {
401+ bool foundContextVars = false ;
402+
403+ if (nt)
404+ {
405+ ConstTransformRcPtr to = nt->getTransform (TRANSFORM_DIR_FORWARD);
406+ if (to && CollectContextVariables (config, context, to, usedContextVars))
407+ {
408+ foundContextVars = true ;
409+ }
410+
411+ ConstTransformRcPtr from = nt->getTransform (TRANSFORM_DIR_INVERSE);
412+ if (from && CollectContextVariables (config, context, from, usedContextVars))
413+ {
414+ foundContextVars = true ;
415+ }
416+ }
417+
418+ return foundContextVars;
419+ }
420+
396421bool CollectContextVariables (const Config & config,
397422 const Context & context,
398423 ConstColorSpaceRcPtr & cs,
@@ -441,15 +466,37 @@ bool CollectContextVariables(const Config & config,
441466 }
442467
443468 ConstColorSpaceRcPtr src = config.getColorSpace (srcName.c_str ());
444- if (CollectContextVariables (config, context, src, usedContextVars) )
469+ if (src)
445470 {
446- foundContextVars = true ;
471+ if (CollectContextVariables (config, context, src, usedContextVars))
472+ {
473+ foundContextVars = true ;
474+ }
475+ }
476+ else
477+ {
478+ ConstNamedTransformRcPtr nt_src = config.getNamedTransform (srcName.c_str ());
479+ if (CollectContextVariables (config, context, nt_src, usedContextVars))
480+ {
481+ foundContextVars = true ;
482+ }
447483 }
448484
449485 ConstColorSpaceRcPtr dst = config.getColorSpace (dstName.c_str ());
450- if (CollectContextVariables (config, context, dst, usedContextVars) )
486+ if (dst)
451487 {
452- foundContextVars = true ;
488+ if (CollectContextVariables (config, context, dst, usedContextVars))
489+ {
490+ foundContextVars = true ;
491+ }
492+ }
493+ else
494+ {
495+ ConstNamedTransformRcPtr nt_dst = config.getNamedTransform (dstName.c_str ());
496+ if (CollectContextVariables (config, context, nt_dst, usedContextVars))
497+ {
498+ foundContextVars = true ;
499+ }
453500 }
454501
455502 return foundContextVars;
0 commit comments