< prev index next >

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

Print this page
*** 941,11 ***
             // 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
!     if (_cmsFormatterIsFloat(*OutputFormat)) {
  
          // Get formatter function always return a valid union, but the contents of this union may be NULL.
          p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
          p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
          *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
--- 941,11 ---
             // 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
!     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) {
  
          // Get formatter function always return a valid union, but the contents of this union may be NULL.
          p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
          p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
          *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;

*** 1016,10 ***
--- 1016,23 ---
  
              }
          }
      }
  
+     /**
+     * Check consistency for alpha channel copy
+     */
+     if (*dwFlags & cmsFLAGS_COPY_ALPHA)
+     {
+         if (T_EXTRA(*InputFormat) != T_EXTRA(*OutputFormat))
+         {
+             cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Mismatched alpha channels");
+             cmsDeleteTransform(p);
+             return NULL;
+         }
+     }
+ 
      p ->InputFormat     = *InputFormat;
      p ->OutputFormat    = *OutputFormat;
      p ->dwOriginalFlags = *dwFlags;
      p ->ContextID       = ContextID;
      p ->UserData        = NULL;
< prev index next >