Ken Thomases : winemac: Consolidate code paths for clearing the OpenGL context.
Alexandre Julliard
julliard at winehq.org
Tue Jan 14 13:44:59 CST 2014
Module: wine
Branch: master
Commit: 2cc53379404bfb499461add373ddb42c77d224b4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2cc53379404bfb499461add373ddb42c77d224b4
Author: Ken Thomases <ken at codeweavers.com>
Date: Tue Jan 14 01:25:03 2014 -0600
winemac: Consolidate code paths for clearing the OpenGL context.
We clear it if the context or the view is NULL. If the context is non-NULL,
we want to disassociate the views of both the current and passed-in contexts,
if they differ.
---
dlls/winemac.drv/cocoa_opengl.m | 44 ++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 752fb77..196da46 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -154,36 +154,28 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
WineOpenGLContext *context = (WineOpenGLContext*)c;
NSView* view = (NSView*)v;
- if (context)
+ if (context && view)
{
[context removeFromViews:NO];
- if (view)
- {
- macdrv_add_view_opengl_context(v, c);
-
- if (context.needsUpdate)
- {
- context.needsUpdate = FALSE;
- [context setView:view];
- [context setLatentView:nil];
- }
- else
- {
- if ([context view])
- [context clearDrawableLeavingSurfaceOnScreen];
- [context setLatentView:view];
- }
+ macdrv_add_view_opengl_context(v, c);
- [context makeCurrentContext];
-
- if ([context view])
- [context clearToBlackIfNeeded];
+ if (context.needsUpdate)
+ {
+ context.needsUpdate = FALSE;
+ [context setView:view];
+ [context setLatentView:nil];
}
else
{
- [WineOpenGLContext clearCurrentContext];
- [context removeFromViews:YES];
+ if ([context view])
+ [context clearDrawableLeavingSurfaceOnScreen];
+ [context setLatentView:view];
}
+
+ [context makeCurrentContext];
+
+ if ([context view])
+ [context clearToBlackIfNeeded];
}
else
{
@@ -192,8 +184,12 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
if ([currentContext isKindOfClass:[WineOpenGLContext class]])
{
[WineOpenGLContext clearCurrentContext];
- [currentContext removeFromViews:YES];
+ if (currentContext != context)
+ [currentContext removeFromViews:YES];
}
+
+ if (context)
+ [context removeFromViews:YES];
}
[pool release];
More information about the wine-cvs
mailing list