Diff for /np2/macosx/np2opening.cpp between versions 1.1 and 1.3

version 1.1, 2003/10/31 16:55:06 version 1.3, 2003/11/11 16:33:50
Line 11 Line 11
 #include "np2.h"  #include "np2.h"
 #include "np2opening.h"  #include "np2opening.h"
   
 void openingNP2(void) {  
     Rect                srt;  
     GrafPtr             port;  static PicHandle getbmp(FSSpec fsc, Rect* srt) {
     CFURLRef    openingURL;      PicHandle   pict = NULL;
     char                buffer[1024];  
     FSRef               fsr;  
     FSSpec              fsc;  
     PicHandle   pict;  
     GraphicsImportComponent     gi;      GraphicsImportComponent     gi;
           
     GetPort(&port);      if (!GetGraphicsImporterForFile(&fsc, &gi)) {
     SetPortWindowPort(hWndMain);          if (!GraphicsImportGetNaturalBounds(gi, srt)) {
               OffsetRect( srt, -(*srt).left, -(*srt).top);
               GraphicsImportSetBoundsRect(gi, srt);
               GraphicsImportGetAsPicture(gi, &pict);
           }
           CloseComponent(gi);
       }
       return pict;
   }
   
     openingURL=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("nekop2"), CFSTR("bmp"), NULL);  PicHandle getBMPfromPath(char* path, Rect* srt) {
     if (openingURL) {      
         if (CFURLGetFSRef(openingURL, &fsr)) {      Str255              fname;
             FSPathMakeRef((const UInt8*)buffer, &fsr, NULL);      FSSpec              fsc;
       
           mkstr255(fname, path);
           FSMakeFSSpec(0, 0, fname, &fsc);
       return(getbmp(fsc, srt));
   }
   
   PicHandle getBMPfromResource(const char* name, Rect* srt, const CFStringRef     type) {
       CFURLRef    url = NULL;
       FSRef               fsr;
       FSSpec              fsc;
       PicHandle   pict = NULL;
       
       url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTRj(name), type, NULL);
       if (url) {
           if (CFURLGetFSRef(url, &fsr)) {
             FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL);              FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL);
             if (!GetGraphicsImporterForFile(&fsc, &gi)) {              pict = getbmp(fsc, srt);
                 if (!GraphicsImportGetNaturalBounds(gi, &srt)) {  
                     OffsetRect( &srt, -srt.left, -srt.top);  
                     GraphicsImportSetBoundsRect(gi, &srt);  
                     GraphicsImportGetAsPicture(gi, &pict);  
                     OffsetRect(&srt, (640-srt.right)/2, (400-srt.bottom)/2);  
                     DrawPicture(pict,&srt);  
                     QDFlushPortBuffer(GetWindowPort(hWndMain), NULL);  
                     KillPicture(pict);  
                 }  
                 CloseComponent(gi);  
             }  
         }          }
         CFRelease(openingURL);          CFRelease(url);
       }
       return(pict);
   }
   
   void openingNP2(void) {
       Rect                srt;
       GrafPtr             port;
       PicHandle   pict = NULL;
   
       pict = getBMPfromResource("nekop2", &srt, CFSTR("bmp"));
       if (pict) {
           GetPort(&port);
           SetPortWindowPort(hWndMain);
           OffsetRect(&srt, (640-srt.right)/2, (400-srt.bottom)/2);
           DrawPicture(pict,&srt);
           QDFlushPortBuffer(GetWindowPort(hWndMain), NULL);
           SetPort(port);
           KillPicture(pict);
     }      }
     SetPort(port);  
 }  }

Removed from v.1.1  
changed lines
  Added in v.1.3


RetroPC.NET-CVS <cvs@retropc.net>