Fixed a cms bug involving side effects and early return -
bug 454747. r=vlad
--- a/modules/lcms/src/cmsxform.c
+++ b/modules/lcms/src/cmsxform.c
@@ -1534,16 +1534,20 @@ static
if ((*FromTagPtr == 0) &&
(*ToTagPtr == 0) &&
(!p->PreviewProfile) &&
(p -> Intent != INTENT_ABSOLUTE_COLORIMETRIC) &&
(p -> EntryColorSpace == icSigRgbData) &&
(p -> ExitColorSpace == icSigRgbData) &&
!(p -> dwOriginalFlags & cmsFLAGS_BLACKPOINTCOMPENSATION)) {
+ // We've found our type of transform - don't override it later with a precalculated transform
+ p -> dwOriginalFlags |= cmsFLAGS_NOTPRECALC;
+
+
// If the input profile pointer-matches with the output profile,
// optimize the transformation away into a null xform
if (p -> InputProfile == p -> OutputProfile) {
p -> xform = NullXFORM;
return p;
}
// If the floating point path is requested, see if we support it
@@ -1563,18 +1567,16 @@ static
// Yes... try to smelt matrix-shapers
#ifndef HAVE_SSE2_INTEL_MNEMONICS
p -> xform = MatrixShaperXFORM;
#else
p -> xform = (p -> dwOriginalFlags & cmsFLAGS_FLOATSHAPER) ? MatrixShaperXFORMFloat : MatrixShaperXFORM;
#endif
- p -> dwOriginalFlags |= cmsFLAGS_NOTPRECALC;
-
if (!cmsBuildSmeltMatShaper(p))
{
cmsSignalError(LCMS_ERRC_ABORTED, "unable to smelt shaper-matrix, required tags missing");
return NULL;
}
p -> Phase1 = p -> Phase3 = XYZRel;
return p;