mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
@ -7,100 +7,100 @@
|
||||
|
||||
void cInterfaceAGL::Swap()
|
||||
{
|
||||
[cocoaCtx flushBuffer];
|
||||
[cocoaCtx flushBuffer];
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool cInterfaceAGL::Create(void *window_handle, bool core)
|
||||
bool cInterfaceAGL::Create(void* window_handle, bool core)
|
||||
{
|
||||
cocoaWin = reinterpret_cast<NSView*>(window_handle);
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
cocoaWin = reinterpret_cast<NSView*>(window_handle);
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
|
||||
// Enable high-resolution display support.
|
||||
[cocoaWin setWantsBestResolutionOpenGLSurface:YES];
|
||||
// Enable high-resolution display support.
|
||||
[cocoaWin setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
NSWindow *window = [cocoaWin window];
|
||||
NSWindow* window = [cocoaWin window];
|
||||
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
size.height *= scale;
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
size.height *= scale;
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = size.width;
|
||||
s_backbuffer_height = size.height;
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = size.width;
|
||||
s_backbuffer_height = size.height;
|
||||
|
||||
NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, core ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy, NSOpenGLPFAAccelerated, 0 };
|
||||
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
|
||||
initWithAttributes: attr];
|
||||
if (fmt == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create pixel format");
|
||||
return false;
|
||||
}
|
||||
NSOpenGLPixelFormatAttribute attr[] = {NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile,
|
||||
core ? NSOpenGLProfileVersion3_2Core :
|
||||
NSOpenGLProfileVersionLegacy,
|
||||
NSOpenGLPFAAccelerated, 0};
|
||||
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||
if (fmt == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create pixel format");
|
||||
return false;
|
||||
}
|
||||
|
||||
cocoaCtx = [[NSOpenGLContext alloc] initWithFormat: fmt shareContext: nil];
|
||||
[fmt release];
|
||||
if (cocoaCtx == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create context");
|
||||
return false;
|
||||
}
|
||||
cocoaCtx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
||||
[fmt release];
|
||||
if (cocoaCtx == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create context");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cocoaWin == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create window");
|
||||
return false;
|
||||
}
|
||||
if (cocoaWin == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create window");
|
||||
return false;
|
||||
}
|
||||
|
||||
[window makeFirstResponder:cocoaWin];
|
||||
[cocoaCtx setView: cocoaWin];
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
[window makeFirstResponder:cocoaWin];
|
||||
[cocoaCtx setView:cocoaWin];
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cInterfaceAGL::MakeCurrent()
|
||||
{
|
||||
[cocoaCtx makeCurrentContext];
|
||||
return true;
|
||||
[cocoaCtx makeCurrentContext];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cInterfaceAGL::ClearCurrent()
|
||||
{
|
||||
[NSOpenGLContext clearCurrentContext];
|
||||
return true;
|
||||
[NSOpenGLContext clearCurrentContext];
|
||||
return true;
|
||||
}
|
||||
|
||||
// Close backend
|
||||
void cInterfaceAGL::Shutdown()
|
||||
{
|
||||
[cocoaCtx clearDrawable];
|
||||
[cocoaCtx release];
|
||||
cocoaCtx = nil;
|
||||
[cocoaCtx clearDrawable];
|
||||
[cocoaCtx release];
|
||||
cocoaCtx = nil;
|
||||
}
|
||||
|
||||
void cInterfaceAGL::Update()
|
||||
{
|
||||
NSWindow *window = [cocoaWin window];
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
NSWindow* window = [cocoaWin window];
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
size.height *= scale;
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
size.height *= scale;
|
||||
|
||||
if (s_backbuffer_width == size.width &&
|
||||
s_backbuffer_height == size.height)
|
||||
return;
|
||||
if (s_backbuffer_width == size.width && s_backbuffer_height == size.height)
|
||||
return;
|
||||
|
||||
s_backbuffer_width = size.width;
|
||||
s_backbuffer_height = size.height;
|
||||
s_backbuffer_width = size.width;
|
||||
s_backbuffer_height = size.height;
|
||||
|
||||
[cocoaCtx update];
|
||||
[cocoaCtx update];
|
||||
}
|
||||
|
||||
void cInterfaceAGL::SwapInterval(int interval)
|
||||
{
|
||||
[cocoaCtx setValues:(GLint *)&interval forParameter:NSOpenGLCPSwapInterval];
|
||||
[cocoaCtx setValues:(GLint*)&interval forParameter:NSOpenGLCPSwapInterval];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user