< prev index next >

src/java.desktop/share/native/liblcms/cmsps2.c

Print this page
*** 458,73 ***
      _cmsIOPrintf(m, "{dup 6 29 div ge {dup dup mul mul} {4 29 div sub 108 841 div mul} ifelse } bind\n");
      _cmsIOPrintf(m, "{dup 6 29 div ge {dup dup mul mul} {4 29 div sub 108 841 div mul} ifelse 0.824900 mul} bind\n");
      _cmsIOPrintf(m, "]\n");
  }
  
- static
- void EmitSafeGuardBegin(cmsIOHANDLER* m, const char* name)
- {
-     _cmsIOPrintf(m, "%%LCMS2: Save previous definition of %s on the operand stack\n", name);
-     _cmsIOPrintf(m, "currentdict /%s known { /%s load } { null } ifelse\n", name, name);
- }
  
- static
- void EmitSafeGuardEnd(cmsIOHANDLER* m, const char* name, int depth)
- {
-     _cmsIOPrintf(m, "%%LCMS2: Restore previous definition of %s\n", name);
-     if (depth > 1) {
-         // cycle topmost items on the stack to bring the previous definition to the front
-         _cmsIOPrintf(m, "%d -1 roll ", depth);
-     }
-     _cmsIOPrintf(m, "dup null eq { pop currentdict /%s undef } { /%s exch def } ifelse\n", name, name);
- }
  
  // Outputs a table of words. It does use 16 bits
  
  static
! void Emit1Gamma(cmsIOHANDLER* m, cmsToneCurve* Table, const char* name)
  {
      cmsUInt32Number i;
      cmsFloat64Number gamma;
  
!     if (Table == NULL) return; // Error
  
!     if (Table ->nEntries <= 0) return;  // Empty table
  
-     // Suppress whole if identity
-     if (cmsIsToneCurveLinear(Table)) return;
  
      // Check if is really an exponential. If so, emit "exp"
      gamma = cmsEstimateGamma(Table, 0.001);
       if (gamma > 0) {
!             _cmsIOPrintf(m, "/%s { %g exp } bind def\n", name, gamma);
              return;
       }
  
!     EmitSafeGuardBegin(m, "lcms2gammatable");
!     _cmsIOPrintf(m, "/lcms2gammatable [");
  
      for (i=0; i < Table->nEntries; i++) {
      if (i % 10 == 0)
              _cmsIOPrintf(m, "\n  ");
          _cmsIOPrintf(m, "%d ", Table->Table16[i]);
      }
  
!     _cmsIOPrintf(m, "] def\n");
  
- 
-     // Emit interpolation code
- 
-     // PostScript code                            Stack
-     // ===============                            ========================
-                                                   // v
-     _cmsIOPrintf(m, "/%s {\n  ", name);
- 
-     // Bounds check
-     EmitRangeCheck(m);
- 
-     _cmsIOPrintf(m, "\n  //lcms2gammatable ");    // v tab
      _cmsIOPrintf(m, "dup ");                      // v tab tab
      _cmsIOPrintf(m, "length 1 sub ");             // v tab dom
      _cmsIOPrintf(m, "3 -1 roll ");                // tab dom v
      _cmsIOPrintf(m, "mul ");                      // tab val2
      _cmsIOPrintf(m, "dup ");                      // tab val2 val2
--- 458,59 ---
      _cmsIOPrintf(m, "{dup 6 29 div ge {dup dup mul mul} {4 29 div sub 108 841 div mul} ifelse } bind\n");
      _cmsIOPrintf(m, "{dup 6 29 div ge {dup dup mul mul} {4 29 div sub 108 841 div mul} ifelse 0.824900 mul} bind\n");
      _cmsIOPrintf(m, "]\n");
  }
  
  
  
  // Outputs a table of words. It does use 16 bits
  
  static
! void Emit1Gamma(cmsIOHANDLER* m, cmsToneCurve* Table)
  {
      cmsUInt32Number i;
      cmsFloat64Number gamma;
  
!     /**
+     * On error, empty tables or lienar assume gamma 1.0
+     */
+     if (Table == NULL ||
+         Table->nEntries <= 0 ||
+         cmsIsToneCurveLinear(Table)) {
  
!         _cmsIOPrintf(m, "{ 1 } bind ");
+         return;
+     }
  
  
      // Check if is really an exponential. If so, emit "exp"
      gamma = cmsEstimateGamma(Table, 0.001);
       if (gamma > 0) {
!             _cmsIOPrintf(m, "{ %g exp } bind ", gamma);
              return;
       }
  
!     _cmsIOPrintf(m, "{ ");
! 
+     // Bounds check
+     EmitRangeCheck(m);
+ 
+     // Emit intepolation code
+ 
+     // PostScript code                      Stack
+     // ===============                      ========================
+                                             // v
+     _cmsIOPrintf(m, " [");
  
      for (i=0; i < Table->nEntries; i++) {
      if (i % 10 == 0)
              _cmsIOPrintf(m, "\n  ");
          _cmsIOPrintf(m, "%d ", Table->Table16[i]);
      }
  
!     _cmsIOPrintf(m, "] ");                        // v tab
  
      _cmsIOPrintf(m, "dup ");                      // v tab tab
      _cmsIOPrintf(m, "length 1 sub ");             // v tab dom
      _cmsIOPrintf(m, "3 -1 roll ");                // tab dom v
      _cmsIOPrintf(m, "mul ");                      // tab val2
      _cmsIOPrintf(m, "dup ");                      // tab val2 val2

*** 547,13 ***
      _cmsIOPrintf(m, "sub ");                      // y0 (y1-y0) rest
      _cmsIOPrintf(m, "mul ");                      // y0 t1
      _cmsIOPrintf(m, "add ");                      // y
      _cmsIOPrintf(m, "65535 div\n");               // result
  
!     _cmsIOPrintf(m, "} bind def\n");
- 
-     EmitSafeGuardEnd(m, "lcms2gammatable", 1);
  }
  
  
  // Compare gamma table
  
--- 533,11 ---
      _cmsIOPrintf(m, "sub ");                      // y0 (y1-y0) rest
      _cmsIOPrintf(m, "mul ");                      // y0 t1
      _cmsIOPrintf(m, "add ");                      // y
      _cmsIOPrintf(m, "65535 div\n");               // result
  
!     _cmsIOPrintf(m, " } bind ");
  }
  
  
  // Compare gamma table
  

*** 566,27 ***
  
  
  // Does write a set of gamma curves
  
  static
! void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[], const char* nameprefix)
  {
      cmsUInt32Number i;
!     static char buffer[2048];
  
      for( i=0; i < n; i++ )
      {
          if (g[i] == NULL) return; // Error
  
          if (i > 0 && GammaTableEquals(g[i-1]->Table16, g[i]->Table16, g[i-1]->nEntries, g[i]->nEntries)) {
  
!             _cmsIOPrintf(m, "/%s%d /%s%d load def\n", nameprefix, i, nameprefix, i-1);
          }
          else {
!             snprintf(buffer, sizeof(buffer), "%s%d", nameprefix, (int) i);
-         buffer[sizeof(buffer)-1] = '\0';
-             Emit1Gamma(m, g[i], buffer);
          }
      }
  
  }
  
--- 550,25 ---
  
  
  // Does write a set of gamma curves
  
  static
! void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[])
  {
      cmsUInt32Number i;
! 
  
      for( i=0; i < n; i++ )
      {
          if (g[i] == NULL) return; // Error
  
          if (i > 0 && GammaTableEquals(g[i-1]->Table16, g[i]->Table16, g[i-1]->nEntries, g[i]->nEntries)) {
  
!             _cmsIOPrintf(m, "dup ");
          }
          else {
!             Emit1Gamma(m, g[i]);
          }
      }
  
  }
  

*** 706,22 ***
      sc.PreMin   = PreMin;
      sc.PostMin  = PostMin;
      sc.FixWhite = FixWhite;
      sc.ColorSpace = ColorSpace;
  
!     _cmsIOPrintf(m, "[");
  
!     for (i=0; i < sc.Pipeline->Params->nInputs; i++)
-         _cmsIOPrintf(m, " %d ", sc.Pipeline->Params->nSamples[i]);
  
!     _cmsIOPrintf(m, " [\n");
  
!     cmsStageSampleCLut16bit(mpe, OutputValueSampler, (void*) &sc, SAMPLER_INSPECT);
  
!     _cmsIOPrintf(m, PostMin);
!     _cmsIOPrintf(m, PostMaj);
!     _cmsIOPrintf(m, "] ");
  
  }
  
  
  // Dumps CIEBasedA Color Space Array
--- 688,25 ---
      sc.PreMin   = PreMin;
      sc.PostMin  = PostMin;
      sc.FixWhite = FixWhite;
      sc.ColorSpace = ColorSpace;
  
!     if (sc.Pipeline != NULL && sc.Pipeline->Params != NULL) {
  
!         _cmsIOPrintf(m, "[");
  
!         for (i = 0; i < sc.Pipeline->Params->nInputs; i++)
+             _cmsIOPrintf(m, " %d ", sc.Pipeline->Params->nSamples[i]);
  
!         _cmsIOPrintf(m, " [\n");
  
!         cmsStageSampleCLut16bit(mpe, OutputValueSampler, (void*)&sc, SAMPLER_INSPECT);
! 
!         _cmsIOPrintf(m, PostMin);
+         _cmsIOPrintf(m, PostMaj);
+         _cmsIOPrintf(m, "] ");
+     }
  
  }
  
  
  // Dumps CIEBasedA Color Space Array

*** 731,15 ***
  {
  
      _cmsIOPrintf(m, "[ /CIEBasedA\n");
      _cmsIOPrintf(m, "  <<\n");
  
!     EmitSafeGuardBegin(m, "lcms2gammaproc");
!     Emit1Gamma(m, Curve, "lcms2gammaproc");
  
!     _cmsIOPrintf(m, "/DecodeA /lcms2gammaproc load\n");
-     EmitSafeGuardEnd(m, "lcms2gammaproc", 3);
  
      _cmsIOPrintf(m, "/MatrixA [ 0.9642 1.0000 0.8249 ]\n");
      _cmsIOPrintf(m, "/RangeLMN [ 0.0 0.9642 0.0 1.0000 0.0 0.8249 ]\n");
  
      EmitWhiteBlackD50(m, BlackPoint);
--- 716,15 ---
  {
  
      _cmsIOPrintf(m, "[ /CIEBasedA\n");
      _cmsIOPrintf(m, "  <<\n");
  
!     _cmsIOPrintf(m, "/DecodeA ");
! 
+     Emit1Gamma(m, Curve);
  
!     _cmsIOPrintf(m, " \n");
  
      _cmsIOPrintf(m, "/MatrixA [ 0.9642 1.0000 0.8249 ]\n");
      _cmsIOPrintf(m, "/RangeLMN [ 0.0 0.9642 0.0 1.0000 0.0 0.8249 ]\n");
  
      EmitWhiteBlackD50(m, BlackPoint);

*** 759,23 ***
  {
      int i;
  
      _cmsIOPrintf(m, "[ /CIEBasedABC\n");
      _cmsIOPrintf(m, "<<\n");
  
-     EmitSafeGuardBegin(m, "lcms2gammaproc0");
-     EmitSafeGuardBegin(m, "lcms2gammaproc1");
-     EmitSafeGuardBegin(m, "lcms2gammaproc2");
-     EmitNGamma(m, 3, CurveSet, "lcms2gammaproc");
-     _cmsIOPrintf(m, "/DecodeABC [\n");
-     _cmsIOPrintf(m, "   /lcms2gammaproc0 load\n");
-     _cmsIOPrintf(m, "   /lcms2gammaproc1 load\n");
-     _cmsIOPrintf(m, "   /lcms2gammaproc2 load\n");
      _cmsIOPrintf(m, "]\n");
-     EmitSafeGuardEnd(m, "lcms2gammaproc2", 3);
-     EmitSafeGuardEnd(m, "lcms2gammaproc1", 3);
-     EmitSafeGuardEnd(m, "lcms2gammaproc0", 3);
  
      _cmsIOPrintf(m, "/MatrixABC [ " );
  
      for( i=0; i < 3; i++ ) {
  
--- 744,15 ---
  {
      int i;
  
      _cmsIOPrintf(m, "[ /CIEBasedABC\n");
      _cmsIOPrintf(m, "<<\n");
+     _cmsIOPrintf(m, "/DecodeABC [ ");
+ 
+     EmitNGamma(m, 3, CurveSet);
  
      _cmsIOPrintf(m, "]\n");
  
      _cmsIOPrintf(m, "/MatrixABC [ " );
  
      for( i=0; i < 3; i++ ) {
  

*** 803,14 ***
  static
  int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, cmsUInt32Number Intent, cmsCIEXYZ* BlackPoint)
  {
      const char* PreMaj;
      const char* PostMaj;
!     const char* PreMin, * PostMin;
      cmsStage* mpe;
-     int i, numchans;
-     static char buffer[2048];
  
      mpe = Pipeline->Elements;
  
      switch (cmsStageInputChannels(mpe)) {
      case 3:
--- 780,12 ---
  static
  int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, cmsUInt32Number Intent, cmsCIEXYZ* BlackPoint)
  {
      const char* PreMaj;
      const char* PostMaj;
!     const char* PreMin, *PostMin;
      cmsStage* mpe;
  
      mpe = Pipeline->Elements;
  
      switch (cmsStageInputChannels(mpe)) {
      case 3:

*** 835,38 ***
  
      _cmsIOPrintf(m, "<<\n");
  
      if (cmsStageType(mpe) == cmsSigCurveSetElemType) {
  
!         numchans = (int) cmsStageOutputChannels(mpe);
!         for (i = 0; i < numchans; ++i) {
-             snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i);
-             buffer[sizeof(buffer) - 1] = '\0';
-             EmitSafeGuardBegin(m, buffer);
-         }
-         EmitNGamma(m, cmsStageOutputChannels(mpe), _cmsStageGetPtrToCurveSet(mpe), "lcms2gammaproc");
-         _cmsIOPrintf(m, "/DecodeDEF [\n");
-         for (i = 0; i < numchans; ++i) {
-             snprintf(buffer, sizeof(buffer), "  /lcms2gammaproc%d load\n", i);
-             buffer[sizeof(buffer) - 1] = '\0';
-             _cmsIOPrintf(m, buffer);
-         }
          _cmsIOPrintf(m, "]\n");
-         for (i = numchans - 1; i >= 0; --i) {
-             snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i);
-             buffer[sizeof(buffer) - 1] = '\0';
-             EmitSafeGuardEnd(m, buffer, 3);
-         }
  
!         mpe = mpe->Next;
      }
  
      if (cmsStageType(mpe) == cmsSigCLutElemType) {
  
!         _cmsIOPrintf(m, "/Table ");
!         WriteCLUT(m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature)0);
!         _cmsIOPrintf(m, "]\n");
      }
  
      EmitLab2XYZ(m);
      EmitWhiteBlackD50(m, BlackPoint);
      EmitIntent(m, Intent);
--- 810,22 ---
  
      _cmsIOPrintf(m, "<<\n");
  
      if (cmsStageType(mpe) == cmsSigCurveSetElemType) {
  
!         _cmsIOPrintf(m, "/DecodeDEF [ ");
!         EmitNGamma(m, cmsStageOutputChannels(mpe), _cmsStageGetPtrToCurveSet(mpe));
          _cmsIOPrintf(m, "]\n");
  
!         mpe = mpe ->Next;
      }
  
      if (cmsStageType(mpe) == cmsSigCLutElemType) {
  
!             _cmsIOPrintf(m, "/Table ");
!             WriteCLUT(m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature) 0);
!             _cmsIOPrintf(m, "]\n");
      }
  
      EmitLab2XYZ(m);
      EmitWhiteBlackD50(m, BlackPoint);
      EmitIntent(m, Intent);

*** 1022,13 ***
  
              for (i = 0; i < 3; i++)
                  for (j = 0; j < 3; j++)
                      Mat.v[i].n[j] *= MAX_ENCODEABLE_XYZ;
  
!             rc = EmitCIEBasedABC(m, (cmsFloat64Number *)&Mat,
!                 _cmsStageGetPtrToCurveSet(Shaper),
!                 &BlackPointAdaptedToD50);
          }
          else {
  
              cmsSignalError(m->ContextID, cmsERROR_COLORSPACE_CHECK, "Profile is not suitable for CSA. Unsupported colorspace.");
              return 0;
--- 981,13 ---
  
              for (i = 0; i < 3; i++)
                  for (j = 0; j < 3; j++)
                      Mat.v[i].n[j] *= MAX_ENCODEABLE_XYZ;
  
!             rc = EmitCIEBasedABC(m,  (cmsFloat64Number *) &Mat,
!                                 _cmsStageGetPtrToCurveSet(Shaper),
!                                  &BlackPointAdaptedToD50);
          }
          else {
  
              cmsSignalError(m->ContextID, cmsERROR_COLORSPACE_CHECK, "Profile is not suitable for CSA. Unsupported colorspace.");
              return 0;

*** 1051,23 ***
      char ColorName[cmsMAX_PATH];
      cmsNAMEDCOLORLIST* NamedColorList;
  
      hLab  = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
      xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, hLab, TYPE_Lab_DBL, Intent, 0);
      if (xform == NULL) return 0;
  
      NamedColorList = cmsGetNamedColorList(xform);
!     if (NamedColorList == NULL) return 0;
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "(colorlistcomment) (%s)\n", "Named color CSA");
      _cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
      _cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
  
      nColors   = cmsNamedColorCount(NamedColorList);
  
- 
      for (i=0; i < nColors; i++) {
  
          cmsUInt16Number In[1];
          cmsCIELab Lab;
  
--- 1010,27 ---
      char ColorName[cmsMAX_PATH];
      cmsNAMEDCOLORLIST* NamedColorList;
  
      hLab  = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
      xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, hLab, TYPE_Lab_DBL, Intent, 0);
+     cmsCloseProfile(hLab);
+ 
      if (xform == NULL) return 0;
  
      NamedColorList = cmsGetNamedColorList(xform);
!     if (NamedColorList == NULL) {
+         cmsDeleteTransform(xform);
+         return 0;
+     }
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "(colorlistcomment) (%s)\n", "Named color CSA");
      _cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
      _cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
  
      nColors   = cmsNamedColorCount(NamedColorList);
  
      for (i=0; i < nColors; i++) {
  
          cmsUInt16Number In[1];
          cmsCIELab Lab;
  

*** 1078,16 ***
  
          cmsDoTransform(xform, In, &Lab, 1);
          _cmsIOPrintf(m, "  (%s) [ %.3f %.3f %.3f ]\n", ColorName, Lab.L, Lab.a, Lab.b);
      }
  
- 
- 
      _cmsIOPrintf(m, ">>\n");
  
      cmsDeleteTransform(xform);
-     cmsCloseProfile(hLab);
      return 1;
  }
  
  
  // Does create a Color Space Array on XYZ colorspace for PostScript usage
--- 1041,13 ---

*** 1337,11 ***
      cmsBool lDoBPC = (cmsBool) (dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION);
      cmsBool lFixWhite = (cmsBool) !(dwFlags & cmsFLAGS_NOWHITEONWHITEFIXUP);
      cmsUInt32Number InFrm = TYPE_Lab_16;
      cmsUInt32Number RelativeEncodingIntent;
      cmsColorSpaceSignature ColorSpace;
! 
  
      hLab = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
      if (hLab == NULL) return 0;
  
      OutputFormat = cmsFormatterForColorspaceOfProfile(hProfile, 2, FALSE);
--- 1297,11 ---
      cmsBool lDoBPC = (cmsBool) (dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION);
      cmsBool lFixWhite = (cmsBool) !(dwFlags & cmsFLAGS_NOWHITEONWHITEFIXUP);
      cmsUInt32Number InFrm = TYPE_Lab_16;
      cmsUInt32Number RelativeEncodingIntent;
      cmsColorSpaceSignature ColorSpace;
!     cmsStage* first;
  
      hLab = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
      if (hLab == NULL) return 0;
  
      OutputFormat = cmsFormatterForColorspaceOfProfile(hProfile, 2, FALSE);

*** 1364,22 ***
                                                Profiles, 2, TYPE_Lab_DBL,
                                                OutputFormat, RelativeEncodingIntent, 0);
      cmsCloseProfile(hLab);
  
      if (xform == NULL) {
- 
          cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Cannot create transform Lab -> Profile in CRD creation");
          return 0;
      }
  
      // Get a copy of the internal devicelink
      v = (_cmsTRANSFORM*) xform;
      DeviceLink = cmsPipelineDup(v ->Lut);
!     if (DeviceLink == NULL) return 0;
! 
  
!     // We need a CLUT
      dwFlags |= cmsFLAGS_FORCE_CLUT;
      _cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags);
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "/ColorRenderingType 1\n");
--- 1324,23 ---
                                                Profiles, 2, TYPE_Lab_DBL,
                                                OutputFormat, RelativeEncodingIntent, 0);
      cmsCloseProfile(hLab);
  
      if (xform == NULL) {
          cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Cannot create transform Lab -> Profile in CRD creation");
          return 0;
      }
  
      // Get a copy of the internal devicelink
      v = (_cmsTRANSFORM*) xform;
      DeviceLink = cmsPipelineDup(v ->Lut);
!     if (DeviceLink == NULL) {
!         cmsDeleteTransform(xform);
+         return 0;
+     }
  
!      // We need a CLUT
      dwFlags |= cmsFLAGS_FORCE_CLUT;
      _cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags);
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "/ColorRenderingType 1\n");

*** 1402,21 ***
      if (Intent == INTENT_ABSOLUTE_COLORIMETRIC)
              lFixWhite = FALSE;
  
      _cmsIOPrintf(m, "/RenderTable ");
  
! 
!     WriteCLUT(m, cmsPipelineGetPtrToFirstStage(DeviceLink), "<", ">\n", "", "", lFixWhite, ColorSpace);
  
      _cmsIOPrintf(m, " %d {} bind ", nChannels);
  
      for (i=1; i < nChannels; i++)
              _cmsIOPrintf(m, "dup ");
  
      _cmsIOPrintf(m, "]\n");
  
- 
      EmitIntent(m, Intent);
  
      _cmsIOPrintf(m, ">>\n");
  
      if (!(dwFlags & cmsFLAGS_NODEFAULTRESOURCEDEF)) {
--- 1363,22 ---
      if (Intent == INTENT_ABSOLUTE_COLORIMETRIC)
              lFixWhite = FALSE;
  
      _cmsIOPrintf(m, "/RenderTable ");
  
!     first = cmsPipelineGetPtrToFirstStage(DeviceLink);
!     if (first != NULL) {
+         WriteCLUT(m, first, "<", ">\n", "", "", lFixWhite, ColorSpace);
+     }
  
      _cmsIOPrintf(m, " %d {} bind ", nChannels);
  
      for (i=1; i < nChannels; i++)
              _cmsIOPrintf(m, "dup ");
  
      _cmsIOPrintf(m, "]\n");
  
      EmitIntent(m, Intent);
  
      _cmsIOPrintf(m, ">>\n");
  
      if (!(dwFlags & cmsFLAGS_NODEFAULTRESOURCEDEF)) {

*** 1475,11 ***
      xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, NULL, OutputFormat, Intent, dwFlags);
      if (xform == NULL) return 0;
  
  
      NamedColorList = cmsGetNamedColorList(xform);
!     if (NamedColorList == NULL) return 0;
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "(colorlistcomment) (%s) \n", "Named profile");
      _cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
      _cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
--- 1437,14 ---
      xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, NULL, OutputFormat, Intent, dwFlags);
      if (xform == NULL) return 0;
  
  
      NamedColorList = cmsGetNamedColorList(xform);
!     if (NamedColorList == NULL) {
+         cmsDeleteTransform(xform);
+         return 0;
+     }
  
      _cmsIOPrintf(m, "<<\n");
      _cmsIOPrintf(m, "(colorlistcomment) (%s) \n", "Named profile");
      _cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
      _cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
< prev index next >