ddraw: Set active_device in AddViewport.

This commit is contained in:
Alexander Dorofeyev 2008-04-10 23:11:52 +03:00 committed by Alexandre Julliard
parent 6a48e405db
commit 3e237c6199
2 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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);