Fixed a cms bug involving side effects and early return - bug 454747. r=vlad
authorBobby Holley <bholley@mozilla.com>
Thu, 11 Sep 2008 12:31:28 -0700
changeset 19164 22a82f07723d0583b00d4bd91a9086ce0eba0f29
parent 19163 5c4d3ecd834a5338b971640ab4cf21222a81ca1b
child 19165 91a847a2dd56197d798c97e502b4ac89b4b4ff9a
push id1987
push userbobbyholley@stanford.edu
push dateThu, 11 Sep 2008 19:32:34 +0000
treeherdermozilla-central@22a82f07723d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs454747
milestone1.9.1b1pre
Fixed a cms bug involving side effects and early return - bug 454747. r=vlad
modules/lcms/src/cmsxform.c
--- 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;