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

version 1.1, 2003/10/31 16:55:06 version 1.6, 2004/03/02 23:23:06
Line 11 Line 11
 #include "np2.h"  #include "np2.h"
 #include "np2opening.h"  #include "np2opening.h"
   
 void openingNP2(void) {  
     Rect                srt;  static PicHandle getbmp(FSSpec fsc, Rect* srt) {
     GrafPtr             port;      PicHandle   pict = NULL;
     CFURLRef    openingURL;  
     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;
             FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL);      
             if (!GetGraphicsImporterForFile(&fsc, &gi)) {          mkstr255(fname, path);
                 if (!GraphicsImportGetNaturalBounds(gi, &srt)) {          FSMakeFSSpec(0, 0, fname, &fsc);
                     OffsetRect( &srt, -srt.left, -srt.top);      return(getbmp(fsc, srt));
                     GraphicsImportSetBoundsRect(gi, &srt);  }
                     GraphicsImportGetAsPicture(gi, &pict);  
                     OffsetRect(&srt, (640-srt.right)/2, (400-srt.bottom)/2);  bool getResourceFile(const char* name, FSSpec* fsc) {
                     DrawPicture(pict,&srt);      CFURLRef    url = NULL;
                     QDFlushPortBuffer(GetWindowPort(hWndMain), NULL);      FSRef               fsr;
                     KillPicture(pict);      bool                ret = false;
                 }          CFStringRef str = CFSTRj(name);
                 CloseComponent(gi);      
           if (!str) return (false);
       url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), str, NULL, NULL);
           CFRelease(str);
       if (url) {
           if (CFURLGetFSRef(url, &fsr)) {
               if (FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, fsc, NULL) == noErr) {
                   ret = true;
             }              }
         }          }
         CFRelease(openingURL);          CFRelease(url);
       }
       return(ret);
   }
   
   
   PicHandle getBMPfromResource(const char* name, Rect* srt) {
       FSSpec              fsc;
       PicHandle   pict = NULL;
       
       if (getResourceFile(name, &fsc)) {
           pict = getbmp(fsc, srt);
       }
       return(pict);
   }
   
   void openingNP2(void) {
       Rect                srt;
       GrafPtr             port;
       PicHandle   pict = NULL;
   
       pict = getBMPfromResource("nekop2.bmp", &srt);
       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.6


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