diff options
author | David Robillard <d@drobilla.net> | 2019-08-03 16:14:54 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-09-03 08:32:16 +0200 |
commit | e3b2f305b98747c84fd87eb97e3fa8516acecbfb (patch) | |
tree | 784892b7d0a488422a8f53e0be974d2864506148 /pugl/detail/mac_gl.m | |
parent | 0706f4a121f6f9c5b96a19c4272a8636fc230cbc (diff) | |
download | pugl-e3b2f305b98747c84fd87eb97e3fa8516acecbfb.tar.gz pugl-e3b2f305b98747c84fd87eb97e3fa8516acecbfb.tar.bz2 pugl-e3b2f305b98747c84fd87eb97e3fa8516acecbfb.zip |
Simplify hints implementation
Diffstat (limited to 'pugl/detail/mac_gl.m')
-rw-r--r-- | pugl/detail/mac_gl.m | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/pugl/detail/mac_gl.m b/pugl/detail/mac_gl.m index 6cdf6f6..1392989 100644 --- a/pugl/detail/mac_gl.m +++ b/pugl/detail/mac_gl.m @@ -40,12 +40,14 @@ typedef NSUInteger NSWindowStyleMask; - (id) initWithFrame:(NSRect)frame { - const int major = puglview->hints.context_version_major; - const int profile = ((puglview->hints.use_compat_profile || major < 3) - ? NSOpenGLProfileVersionLegacy - : puglview->hints.context_version_major >= 4 - ? NSOpenGLProfileVersion4_1Core - : NSOpenGLProfileVersion3_2Core); + const bool compat = puglview->hints[PUGL_USE_COMPAT_PROFILE]; + const int samples = puglview->hints[PUGL_SAMPLES]; + const int major = puglview->hints[PUGL_CONTEXT_VERSION_MAJOR]; + const int profile = ((compat || major < 3) + ? NSOpenGLProfileVersionLegacy + : (major >= 4 + ? NSOpenGLProfileVersion4_1Core + : NSOpenGLProfileVersion3_2Core)); NSOpenGLPixelFormatAttribute pixelAttribs[16] = { NSOpenGLPFADoubleBuffer, @@ -53,9 +55,9 @@ typedef NSUInteger NSWindowStyleMask; NSOpenGLPFAOpenGLProfile, profile, NSOpenGLPFAColorSize, 32, NSOpenGLPFADepthSize, 32, - NSOpenGLPFAMultisample, puglview->hints.samples ? 1 : 0, - NSOpenGLPFASampleBuffers, puglview->hints.samples ? 1 : 0, - NSOpenGLPFASamples, puglview->hints.samples, + NSOpenGLPFAMultisample, samples ? 1 : 0, + NSOpenGLPFASampleBuffers, samples ? 1 : 0, + NSOpenGLPFASamples, samples, 0}; NSOpenGLPixelFormat* pixelFormat = [ @@ -113,7 +115,7 @@ puglMacGlCreate(PuglView* view) drawView->puglview = view; [drawView initWithFrame:NSMakeRect(0, 0, view->width, view->height)]; - if (view->hints.resizable) { + if (view->hints[PUGL_RESIZABLE]) { [drawView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; } else { [drawView setAutoresizingMask:NSViewNotSizable]; |