Commit 3e237c61 authored by Alexander Dorofeyev's avatar Alexander Dorofeyev Committed by Alexandre Julliard

ddraw: Set active_device in AddViewport.

parent 6a48e405
......@@ -817,6 +817,8 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface,
EnterCriticalSection(&ddraw_cs);
vp->next = This->viewport_list;
This->viewport_list = vp;
vp->active_device = This; /* Viewport must be usable for Clear() after AddViewport,
so set active_device here. */
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
......
......@@ -312,10 +312,12 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
This->viewports.vp1.dvMaxZ = 1.0;
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
if(current_viewport) IDirect3DViewport3_Release(current_viewport);
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
IDirect3DViewport3_Release(current_viewport);
}
}
LeaveCriticalSection(&ddraw_cs);
......@@ -900,10 +902,12 @@ IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
IDirect3DViewport3_Release(current_viewport);
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (current_viewport) {
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This, FALSE);
IDirect3DViewport3_Release(current_viewport);
}
}
LeaveCriticalSection(&ddraw_cs);
......
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