mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Remove NSAutoreleasePools that are no longer necessary now that pools
are properly declared at thread entry/exit. I am leaving the ones in Wiiuse while there's still a small hope that it may be used outside of Dolphin, though. Move the fixed MAP_32BIT definition for OS X to Common.h. UDPNunchuk.cpp was deleted, so update the scons build. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5864 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,39 +1,27 @@
|
||||
#import "cocoaGL.h"
|
||||
|
||||
NSWindow *cocoaGLCreateWindow(int w,int h)
|
||||
NSWindow *cocoaGLCreateWindow(int w, int h)
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSWindow *window;
|
||||
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,50,w,h)
|
||||
styleMask:NSTitledWindowMask | NSResizableWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:FALSE];
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(50, 50, w, h)
|
||||
styleMask: NSTitledWindowMask | NSResizableWindowMask
|
||||
backing: NSBackingStoreBuffered defer: FALSE];
|
||||
[window setReleasedWhenClosed: YES];
|
||||
|
||||
[window setTitle:@"Dolphin on OSX"];
|
||||
//[window makeKeyAndOrderFront: nil];
|
||||
|
||||
[pool release];
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void cocoaGLSetTitle(NSWindow *win, const char *title)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title encoding: NSASCIIStringEncoding] autorelease]];
|
||||
|
||||
[pool release];
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title
|
||||
encoding: NSASCIIStringEncoding] autorelease]];
|
||||
}
|
||||
|
||||
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
int value = 0;
|
||||
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
@ -41,35 +29,27 @@ void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||
[ctx setView:[win contentView]];
|
||||
[ctx update];
|
||||
[ctx makeCurrentContext];
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
[NSOpenGLContext clearCurrentContext];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
||||
|
||||
NSOpenGLContext* cocoaGLInit(int mode)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
NSOpenGLPixelFormatAttribute attr[32];
|
||||
NSOpenGLPixelFormat *fmt;
|
||||
NSOpenGLContext *context;
|
||||
int i = 0;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
attr[i++] = NSOpenGLPFADepthSize;
|
||||
attr[i++] = 24;
|
||||
attr[i++] = NSOpenGLPFADoubleBuffer;
|
||||
|
||||
|
||||
attr[i++] = NSOpenGLPFASampleBuffers;
|
||||
attr[i++] = mode;
|
||||
attr[i++] = NSOpenGLPFASamples;
|
||||
attr[i++] = 1;
|
||||
|
||||
|
||||
attr[i++] = NSOpenGLPFANoRecovery;
|
||||
#ifdef GL_VERSION_1_3
|
||||
|
||||
@ -87,9 +67,8 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
||||
attr[i] = 0;
|
||||
|
||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||
if (fmt == nil) {
|
||||
if (fmt == nil) {
|
||||
printf("failed to create pixel format\n");
|
||||
[pool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -99,51 +78,32 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
||||
|
||||
if (context == nil) {
|
||||
printf("failed to create context\n");
|
||||
[pool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
[pool release];
|
||||
|
||||
return context;
|
||||
|
||||
}
|
||||
|
||||
void cocoaGLDelete(NSOpenGLContext *ctx)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[ctx clearDrawable];
|
||||
[ctx release];
|
||||
|
||||
[pool release];
|
||||
|
||||
}
|
||||
|
||||
void cocoaGLDeleteWindow(NSWindow *window)
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[window close];
|
||||
[pool release];
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx, NSWindow *window)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
|
||||
ctx = [NSOpenGLContext currentContext];
|
||||
if (ctx != nil)
|
||||
if (ctx != nil)
|
||||
[ctx flushBuffer];
|
||||
else
|
||||
printf("bad cocoa gl ctx\n");
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
Reference in New Issue
Block a user