< prev index next >

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

Print this page

 926                        p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 927                        p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 928 
 929                        // Save the day? (Ignore the warning)
 930                        if (Plugin->OldXform) {
 931                            p->OldXform = (_cmsTransformFn)(void*)p->xform;
 932                            p->xform = _cmsTransform2toTransformAdaptor;
 933                        }
 934 
 935                        ParalellizeIfSuitable(p);
 936                        return p;
 937                    }
 938                }
 939            }
 940 
 941            // Not suitable for the transform plug-in, let's check  the pipeline plug-in
 942            _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
 943        }
 944 
 945     // Check whatever this is a true floating point transform
 946     if (_cmsFormatterIsFloat(*OutputFormat)) {
 947 
 948         // Get formatter function always return a valid union, but the contents of this union may be NULL.
 949         p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 950         p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 951         *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
 952 
 953         if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) {
 954 
 955             cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
 956             cmsDeleteTransform(p);
 957             return NULL;
 958         }
 959 
 960         if (*dwFlags & cmsFLAGS_NULLTRANSFORM) {
 961 
 962             p ->xform = NullFloatXFORM;
 963         }
 964         else {
 965             // Float transforms don't use cache, always are non-NULL
 966             p ->xform = FloatXFORM;

1001         }
1002         else {
1003             if (*dwFlags & cmsFLAGS_NOCACHE) {
1004 
1005                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
1006                     p ->xform = PrecalculatedXFORMGamutCheck;  // Gamut check, no cache
1007                 else
1008                     p ->xform = PrecalculatedXFORM;  // No cache, no gamut check
1009             }
1010             else {
1011 
1012                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
1013                     p ->xform = CachedXFORMGamutCheck;    // Gamut check, cache
1014                 else
1015                     p ->xform = CachedXFORM;  // No gamut check, cache
1016 
1017             }
1018         }
1019     }
1020 













1021     p ->InputFormat     = *InputFormat;
1022     p ->OutputFormat    = *OutputFormat;
1023     p ->dwOriginalFlags = *dwFlags;
1024     p ->ContextID       = ContextID;
1025     p ->UserData        = NULL;
1026     ParalellizeIfSuitable(p);
1027     return p;
1028 }
1029 
1030 static
1031 cmsBool GetXFormColorSpaces(cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[], cmsColorSpaceSignature* Input, cmsColorSpaceSignature* Output)
1032 {
1033     cmsColorSpaceSignature ColorSpaceIn, ColorSpaceOut;
1034     cmsColorSpaceSignature PostColorSpace;
1035     cmsUInt32Number i;
1036 
1037     if (nProfiles == 0) return FALSE;
1038     if (hProfiles[0] == NULL) return FALSE;
1039 
1040     *Input = PostColorSpace = cmsGetColorSpace(hProfiles[0]);

 926                        p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 927                        p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 928 
 929                        // Save the day? (Ignore the warning)
 930                        if (Plugin->OldXform) {
 931                            p->OldXform = (_cmsTransformFn)(void*)p->xform;
 932                            p->xform = _cmsTransform2toTransformAdaptor;
 933                        }
 934 
 935                        ParalellizeIfSuitable(p);
 936                        return p;
 937                    }
 938                }
 939            }
 940 
 941            // Not suitable for the transform plug-in, let's check  the pipeline plug-in
 942            _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
 943        }
 944 
 945     // Check whatever this is a true floating point transform
 946     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) {
 947 
 948         // Get formatter function always return a valid union, but the contents of this union may be NULL.
 949         p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 950         p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 951         *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
 952 
 953         if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) {
 954 
 955             cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
 956             cmsDeleteTransform(p);
 957             return NULL;
 958         }
 959 
 960         if (*dwFlags & cmsFLAGS_NULLTRANSFORM) {
 961 
 962             p ->xform = NullFloatXFORM;
 963         }
 964         else {
 965             // Float transforms don't use cache, always are non-NULL
 966             p ->xform = FloatXFORM;

1001         }
1002         else {
1003             if (*dwFlags & cmsFLAGS_NOCACHE) {
1004 
1005                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
1006                     p ->xform = PrecalculatedXFORMGamutCheck;  // Gamut check, no cache
1007                 else
1008                     p ->xform = PrecalculatedXFORM;  // No cache, no gamut check
1009             }
1010             else {
1011 
1012                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
1013                     p ->xform = CachedXFORMGamutCheck;    // Gamut check, cache
1014                 else
1015                     p ->xform = CachedXFORM;  // No gamut check, cache
1016 
1017             }
1018         }
1019     }
1020 
1021     /**
1022     * Check consistency for alpha channel copy
1023     */
1024     if (*dwFlags & cmsFLAGS_COPY_ALPHA)
1025     {
1026         if (T_EXTRA(*InputFormat) != T_EXTRA(*OutputFormat))
1027         {
1028             cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Mismatched alpha channels");
1029             cmsDeleteTransform(p);
1030             return NULL;
1031         }
1032     }
1033 
1034     p ->InputFormat     = *InputFormat;
1035     p ->OutputFormat    = *OutputFormat;
1036     p ->dwOriginalFlags = *dwFlags;
1037     p ->ContextID       = ContextID;
1038     p ->UserData        = NULL;
1039     ParalellizeIfSuitable(p);
1040     return p;
1041 }
1042 
1043 static
1044 cmsBool GetXFormColorSpaces(cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[], cmsColorSpaceSignature* Input, cmsColorSpaceSignature* Output)
1045 {
1046     cmsColorSpaceSignature ColorSpaceIn, ColorSpaceOut;
1047     cmsColorSpaceSignature PostColorSpace;
1048     cmsUInt32Number i;
1049 
1050     if (nProfiles == 0) return FALSE;
1051     if (hProfiles[0] == NULL) return FALSE;
1052 
1053     *Input = PostColorSpace = cmsGetColorSpace(hProfiles[0]);
< prev index next >