Commit 2cc53379 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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.
parent d57a99b4
...@@ -154,36 +154,28 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v) ...@@ -154,36 +154,28 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
WineOpenGLContext *context = (WineOpenGLContext*)c; WineOpenGLContext *context = (WineOpenGLContext*)c;
NSView* view = (NSView*)v; NSView* view = (NSView*)v;
if (context) if (context && view)
{ {
[context removeFromViews:NO]; [context removeFromViews:NO];
if (view) macdrv_add_view_opengl_context(v, c);
{
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];
}
[context makeCurrentContext]; if (context.needsUpdate)
{
if ([context view]) context.needsUpdate = FALSE;
[context clearToBlackIfNeeded]; [context setView:view];
[context setLatentView:nil];
} }
else else
{ {
[WineOpenGLContext clearCurrentContext]; if ([context view])
[context removeFromViews:YES]; [context clearDrawableLeavingSurfaceOnScreen];
[context setLatentView:view];
} }
[context makeCurrentContext];
if ([context view])
[context clearToBlackIfNeeded];
} }
else else
{ {
...@@ -192,8 +184,12 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v) ...@@ -192,8 +184,12 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
if ([currentContext isKindOfClass:[WineOpenGLContext class]]) if ([currentContext isKindOfClass:[WineOpenGLContext class]])
{ {
[WineOpenGLContext clearCurrentContext]; [WineOpenGLContext clearCurrentContext];
[currentContext removeFromViews:YES]; if (currentContext != context)
[currentContext removeFromViews:YES];
} }
if (context)
[context removeFromViews:YES];
} }
[pool release]; [pool release];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment