mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
ddraw: device::GetCurrentViewport returns an error if no viewport is set.
This commit is contained in:
parent
07197a19f2
commit
9a0b2a5100
2 changed files with 16 additions and 16 deletions
|
@ -1758,16 +1758,18 @@ static HRESULT WINAPI d3d_device3_GetCurrentViewport(IDirect3DDevice3 *iface, ID
|
|||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
*viewport = &device->current_viewport->IDirect3DViewport3_iface;
|
||||
if (!device->current_viewport)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
WARN("No current viewport, returning D3DERR_NOCURRENTVIEWPORT\n");
|
||||
return D3DERR_NOCURRENTVIEWPORT;
|
||||
}
|
||||
|
||||
/* AddRef the returned viewport */
|
||||
if (*viewport)
|
||||
IDirect3DViewport3_AddRef(*viewport);
|
||||
*viewport = &device->current_viewport->IDirect3DViewport3_iface;
|
||||
IDirect3DViewport3_AddRef(*viewport);
|
||||
|
||||
TRACE("Returning interface %p.\n", *viewport);
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,10 +342,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE
|
|||
This->viewports.vp1.dvMinZ = 0.0;
|
||||
This->viewports.vp1.dvMaxZ = 1.0;
|
||||
|
||||
if (This->active_device) {
|
||||
if (This->active_device)
|
||||
{
|
||||
IDirect3DDevice3 *d3d_device3 = &This->active_device->IDirect3DDevice3_iface;
|
||||
IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport);
|
||||
if (current_viewport)
|
||||
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport)))
|
||||
{
|
||||
if (current_viewport == iface) viewport_activate(This, FALSE);
|
||||
IDirect3DViewport3_Release(current_viewport);
|
||||
|
@ -705,8 +705,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface,
|
|||
hr = IDirect3DDevice7_Clear(&This->active_device->IDirect3DDevice7_iface, rect_count, rects,
|
||||
flags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET), color, 1.0, 0x00000000);
|
||||
|
||||
IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport);
|
||||
if (current_viewport)
|
||||
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport)))
|
||||
{
|
||||
struct d3d_viewport *vp = impl_from_IDirect3DViewport3(current_viewport);
|
||||
viewport_activate(vp, TRUE);
|
||||
|
@ -979,10 +978,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport2(IDirect3DViewport3 *iface, D3DVI
|
|||
memset(&(This->viewports.vp2), 0, sizeof(This->viewports.vp2));
|
||||
memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
|
||||
|
||||
if (This->active_device) {
|
||||
if (This->active_device)
|
||||
{
|
||||
IDirect3DDevice3 *d3d_device3 = &This->active_device->IDirect3DDevice3_iface;
|
||||
IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport);
|
||||
if (current_viewport)
|
||||
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport)))
|
||||
{
|
||||
if (current_viewport == iface) viewport_activate(This, FALSE);
|
||||
IDirect3DViewport3_Release(current_viewport);
|
||||
|
@ -1087,8 +1086,7 @@ static HRESULT WINAPI d3d_viewport_Clear2(IDirect3DViewport3 *iface, DWORD rect_
|
|||
|
||||
hr = IDirect3DDevice7_Clear(&viewport->active_device->IDirect3DDevice7_iface,
|
||||
rect_count, rects, flags, color, depth, stencil);
|
||||
IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport);
|
||||
if (current_viewport)
|
||||
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport)))
|
||||
{
|
||||
struct d3d_viewport *vp = impl_from_IDirect3DViewport3(current_viewport);
|
||||
viewport_activate(vp, TRUE);
|
||||
|
|
Loading…
Reference in a new issue