4 |
|
* video_macosx.mm - Interface between Basilisk II and Cocoa windowing. |
5 |
|
* Based on video_amiga.cpp and video_x.cpp |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2003 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
8 |
|
* |
9 |
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
101 |
|
bool |
102 |
|
parse_screen_prefs(const char *mode_str) |
103 |
|
{ |
104 |
+ |
if ( ! mode_str ) |
105 |
+ |
{ |
106 |
+ |
// No screen pref was found. Supply a default: |
107 |
+ |
mode_str = "win/512/384"; |
108 |
+ |
} |
109 |
+ |
|
110 |
|
if (sscanf(mode_str, "win/%hd/%hd/%hd", |
111 |
|
&init_width, &init_height, &init_depth) == 3) |
112 |
|
display_type = DISPLAY_WINDOW; |
455 |
|
|
456 |
|
D(bug(", new x=%g, y=%g\n", rect.size.width, rect.size.height)); |
457 |
|
|
458 |
< |
[the_win setFrame: rect display: YES]; |
458 |
> |
[the_win setFrame: rect display: YES animate: YES]; |
459 |
> |
[the_win center]; |
460 |
|
rect = [the_win frame]; |
461 |
|
} |
462 |
|
|
570 |
|
|
571 |
|
#ifdef CG_USE_ALPHA |
572 |
|
mask_buffer(the_buffer, x, the_buffer_size); |
573 |
+ |
|
574 |
+ |
/* Create an image mask with this call? */ |
575 |
+ |
//CG_EXTERN CGImageRef |
576 |
+ |
//CGImageMaskCreate(size_t width, size_t height, size_t bitsPerComponent, |
577 |
+ |
// size_t bitsPerPixel, size_t bytesPerRow, |
578 |
+ |
// CGDataProviderRef provider, const float decode[], bool shouldInterpolate); |
579 |
|
#endif |
580 |
|
|
581 |
|
return true; |
909 |
|
|
910 |
|
for (i = VideoMonitors.begin(); i != end; ++i) |
911 |
|
dynamic_cast<OSX_monitor *>(*i)->video_close(); |
912 |
+ |
|
913 |
+ |
VideoMonitors.clear(); |
914 |
+ |
VideoModes.clear(); |
915 |
|
} |
916 |
|
|
917 |
|
|
1036 |
|
failure = "Could not get base address of screen"; |
1037 |
|
|
1038 |
|
} |
1039 |
+ |
#ifdef CGIMAGEREF |
1040 |
+ |
// Clean up the old CGImageRef stuff |
1041 |
+ |
else if ( display_type == DISPLAY_WINDOW && imageRef ) |
1042 |
+ |
{ |
1043 |
+ |
CGImageRef oldImageRef = imageRef; |
1044 |
+ |
CGColorSpaceRef oldColourSpace = colourSpace; |
1045 |
+ |
CGDataProviderRef oldProvider = provider; |
1046 |
+ |
void *oldBuffer = the_buffer; |
1047 |
+ |
|
1048 |
+ |
if ( video_open(mode) ) |
1049 |
+ |
{ |
1050 |
+ |
CGImageRelease(oldImageRef); |
1051 |
+ |
CGColorSpaceRelease(oldColourSpace); |
1052 |
+ |
CGDataProviderRelease(oldProvider); |
1053 |
+ |
free(oldBuffer); |
1054 |
+ |
} |
1055 |
+ |
else |
1056 |
+ |
failure = "Could not video_open() requested mode"; |
1057 |
+ |
} |
1058 |
+ |
#endif |
1059 |
|
else if ( ! video_open(mode) ) |
1060 |
|
failure = "Could not video_open() requested mode"; |
1061 |
|
|
1111 |
|
void VideoRefresh(void) |
1112 |
|
{ |
1113 |
|
} |
1114 |
+ |
|
1115 |
+ |
|
1116 |
+ |
|
1117 |
+ |
// Deal with a memory access signal referring to the screen. |
1118 |
+ |
// For now, just ignore |
1119 |
+ |
bool Screen_fault_handler(char *a, char *b) |
1120 |
+ |
{ |
1121 |
+ |
// NSLog(@"Got a screen fault %lx %lx", a, b); |
1122 |
+ |
// [output setNeedsDisplay: YES]; |
1123 |
+ |
return YES; |
1124 |
+ |
} |