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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 23 11:24:21 CST 2016


Module: wine
Branch: master
Commit: 38f579f9ba0aba49788c2ce84172ae5237929ef4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=38f579f9ba0aba49788c2ce84172ae5237929ef4

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Feb 22 21:14:30 2016 -0600

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

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

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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,17 +227,17 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
     {
         WineOpenGLContext* currentContext = (WineOpenGLContext*)[WineOpenGLContext currentContext];
 
-        if ([currentContext isKindOfClass:[WineOpenGLContext class]])
-        {
-            [WineOpenGLContext clearCurrentContext];
-            if (currentContext != context)
-                [currentContext removeFromViews:YES];
-        }
+        [context removeFromViews:YES];
 
-        if (context)
+        if (currentContext != context)
         {
-            [context removeFromViews:YES];
-            [context makeCurrentContext];
+            if (context)
+                [context makeCurrentContext];
+            else
+                [WineOpenGLContext clearCurrentContext];
+
+            if ([currentContext isKindOfClass:[WineOpenGLContext class]])
+                [currentContext removeFromViews:YES];
         }
     }
 




More information about the wine-cvs mailing list