diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
| commit | 3570c7f03a2aa90aa634f96c0af1969af610f14d (patch) | |
| tree | 4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/Common/GL/GLInterface/AGL.cpp | |
| parent | 2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff) | |
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/Common/GL/GLInterface/AGL.cpp')
| -rw-r--r-- | Source/Core/Common/GL/GLInterface/AGL.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/Source/Core/Common/GL/GLInterface/AGL.cpp b/Source/Core/Common/GL/GLInterface/AGL.cpp index d5d905b5c5..78b2db2ea4 100644 --- a/Source/Core/Common/GL/GLInterface/AGL.cpp +++ b/Source/Core/Common/GL/GLInterface/AGL.cpp @@ -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; - - // Enable high-resolution display support. - [cocoaWin setWantsBestResolutionOpenGLSurface:YES]; - - NSWindow *window = [cocoaWin window]; - - 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; - - 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; - } - - if (cocoaWin == nil) - { - ERROR_LOG(VIDEO, "failed to create window"); - return false; - } - - [window makeFirstResponder:cocoaWin]; - [cocoaCtx setView: cocoaWin]; - [window makeKeyAndOrderFront: nil]; - - return true; + cocoaWin = reinterpret_cast<NSView*>(window_handle); + NSSize size = [cocoaWin frame].size; + + // Enable high-resolution display support. + [cocoaWin setWantsBestResolutionOpenGLSurface:YES]; + + NSWindow* window = [cocoaWin window]; + + 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; + + 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; + } + + if (cocoaWin == nil) + { + ERROR_LOG(VIDEO, "failed to create window"); + return false; + } + + [window makeFirstResponder:cocoaWin]; + [cocoaCtx setView:cocoaWin]; + [window makeKeyAndOrderFront:nil]; + + 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]; } - |
