winemac: Simplify and optimize making a GL context current with no view.

Ken Thomases ken at codeweavers.com
Mon Feb 22 21:14:30 CST 2016


If the context is already current, don't do +clearCurrentContext followed by
-makeCurrentContext.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/winemac.drv/cocoa_opengl.m | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 4694dfd..e1aca77 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -227,18 +227,18 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
     {
         WineOpenGLContext* currentContext = (WineOpenGLContext*)[WineOpenGLContext currentContext];
 
-        if ([currentContext isKindOfClass:[WineOpenGLContext class]])
+        [context removeFromViews:YES];
+
+        if (currentContext != context)
         {
-            [WineOpenGLContext clearCurrentContext];
-            if (currentContext != context)
+            if (context)
+                [context makeCurrentContext];
+            else
+                [WineOpenGLContext clearCurrentContext];
+
+            if ([currentContext isKindOfClass:[WineOpenGLContext class]])
                 [currentContext removeFromViews:YES];
         }
-
-        if (context)
-        {
-            [context removeFromViews:YES];
-            [context makeCurrentContext];
-        }
     }
 
     [pool release];
-- 
2.6.0




More information about the wine-patches mailing list