00063 {
00064     
CMError                                     err = 
noErr;
00065     
OSErr                                       aOSerr = 
noErr;
00066     
CMConcatProfileSet          *profileSet = 
nil;
00067     
CMCoreProfileHeader         sourceHeader;
00068     
CMCoreProfileHeader         destHeader;
00069     
Boolean                                     valid;
00070     
short                                       mode = 0;
00071 
#ifdef DEBUG_OUTPUT
00072 
    long                                        timer = 
TickCount();
00073 
#endif
00074 
00075 
#ifdef DEBUG_OUTPUT
00076 
    if ( DebugCheck(kThisFile, kDebugMiscInfo) )
00077         
DebugPrint(
"¥ ->CMMInitPrivate\n");
00078 
#endif
00079 
00080     
00081     err = 
CMValidateProfile( srcProfile, &valid );
00082     
if (err)
00083         
goto CleanupAndExit;
00084     
if (!valid)
00085     {
00086 
#ifdef DEBUG_OUTPUT
00087 
        if ( DebugCheck(kThisFile, kDebugErrorInfo) )
00088             
DebugPrint(
"¥ CMMInitPrivate ERROR:  srcProfile is NOT valid!\n");
00089 
#endif
00090 
        
00091 
#ifdef realThing
00092 
        err = 
cmProfileError;
00093         
goto CleanupAndExit;
00094 
#endif
00095 
    }
00096 
00097     err = 
CMValidateProfile(dstProfile, &valid );
00098     
if (err)
00099         
goto CleanupAndExit;
00100     
if (!valid)
00101     {
00102 
#ifdef DEBUG_OUTPUT
00103 
        if ( DebugCheck(kThisFile, kDebugErrorInfo) )
00104             
DebugPrint(
"¥ CMMInitPrivate ERROR:  dstProfile is NOT valid!\n");
00105 
#endif
00106 
#ifdef realThing
00107 
        err = 
cmProfileError;
00108         
goto CleanupAndExit;
00109 
#endif
00110 
    }
00111     
00112     
00113         (storage)->lutParam.inputLut  = 
DISPOSE_IF_DATA((storage)->lutParam.inputLut);
00114         (storage)->lutParam.colorLut  = 
DISPOSE_IF_DATA((storage)->lutParam.colorLut);
00115         (storage)->lutParam.outputLut = 
DISPOSE_IF_DATA((storage)->lutParam.outputLut);
00116         
00117         (storage)->gamutLutParam.inputLut  = 
DISPOSE_IF_DATA((storage)->gamutLutParam.inputLut);
00118         (storage)->gamutLutParam.colorLut  = 
DISPOSE_IF_DATA((storage)->gamutLutParam.colorLut);
00119         (storage)->gamutLutParam.outputLut = 
DISPOSE_IF_DATA((storage)->gamutLutParam.outputLut);
00120 
00121         (storage)->theNamedColorTagData = 
DISPOSE_IF_DATA((storage)->theNamedColorTagData);
00122         
00123         (storage)->srcProfileVersion = 
icVersionNumber;
00124     (storage)->dstProfileVersion = 
icVersionNumber;
00125 
00126     
00127     err = 
CMGetProfileHeader( srcProfile, &sourceHeader);
00128     
if (err)
00129         
goto CleanupAndExit;
00130 
00131     
if ( !((sourceHeader.
version & 0xff000000) >= 
icVersionNumber) ){
00132         err = 
cmProfileError;
00133         
goto CleanupAndExit;
00134     }
00135         
if (sourceHeader.
deviceClass == 
icSigLinkClass)
00136         {
00137                 err = 
cmCantConcatenateError;
00138                 
goto CleanupAndExit;
00139         }
00140 
00141     
00142     err = 
CMGetProfileHeader( dstProfile, &destHeader);
00143     
if (err)
00144         
goto CleanupAndExit;
00145 
00146     
if ( !((destHeader.
version & 0xff000000) >= 
icVersionNumber) ){
00147         err = 
cmProfileError;
00148         
goto CleanupAndExit;
00149     }
00150         
if (destHeader.
deviceClass == 
icSigLinkClass)
00151         {
00152                 err = 
cmCantConcatenateError;
00153                 
goto CleanupAndExit;
00154         }
00155         storage->lookup =  (
Boolean)((sourceHeader.
flags & 
kLookupOnlyMask)>>16);               
00156         
00157 
#ifdef RenderInt
00158 
        if( storage-> 
dwFlags != 0xffffffff ){
00159                 storage->lookup = (
Boolean)((storage-> 
dwFlags & 
kLookupOnlyMask)>>16);
00160         }
00161 
#endif
00162 
    
00163                 profileSet = (
CMConcatProfileSet *)
SmartNewPtr(
sizeof (
CMConcatProfileSet) + 
sizeof(CMProfileRef), &aOSerr);
00164                 
if (aOSerr)
00165                     
goto CleanupAndExit;
00166                     
00167                 profileSet->
count    = 2;
00168                 profileSet->
keyIndex = 1;
00169                 
00170                 profileSet->
profileSet[0] = srcProfile;
00171                 
00172                 profileSet->
profileSet[1] = dstProfile;
00173                 
00174                      
00175                 err =  
PrepareCombiLUTs( storage, profileSet ); 
00176     
if (err)
00177         
goto CleanupAndExit;
00178 
00179 CleanupAndExit:
00180     profileSet = (
CMConcatProfileSet*)
DisposeIfPtr( (Ptr)profileSet );
00181 
00182 
#ifdef DEBUG_OUTPUT
00183 
    if ( err && DebugCheck(kThisFile, kDebugErrorInfo) )
00184         
DebugPrint(
"¥ CMMInitPrivate: err = %d\n", err);
00185     
if ( DebugCheck(kThisFile, kDebugTimingInfo) )
00186         
DebugPrint(
"  time in CMMInitPrivate: %f second(s)\n",(
TickCount()-timer)/60.0);
00187     
if ( DebugCheck(kThisFile, kDebugMiscInfo) )
00188         
DebugPrint(
"¥ <-CMMInitPrivate\n");
00189 
#endif
00190 
        return err;
00191 }