ddraw: Adjust the d3d viewport when changing the back buffer.

WineD3D sets up the viewport according to the front buffer, so this
needs to be changed to the values of the render target passed when the
d3d7 device is created and this device turns out not to be the known
front or back buffer.
This commit is contained in:
Stefan Dösinger 2007-04-28 14:50:15 +02:00 committed by Alexandre Julliard
parent c87d5352a5
commit 742260d418
2 changed files with 21 additions and 0 deletions

View File

@ -306,6 +306,17 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
/* Restore the render targets */
if(This->OffScreenTarget)
{
WINED3DVIEWPORT vp;
vp.X = 0;
vp.Y = 0;
vp.Width = This->ddraw->d3d_target->surface_desc.dwWidth;
vp.Height = This->ddraw->d3d_target->surface_desc.dwHeight;
vp.MinZ = 0.0;
vp.MaxZ = 1.0;
IWineD3DDevice_SetViewport(This->wineD3DDevice,
&vp);
/* Set the device up to render to the front buffer since the back buffer will
* vanish soon.
*/

View File

@ -844,6 +844,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
if(!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) &&
(This->d3d_target != target))
{
WINED3DVIEWPORT vp;
TRACE("(%p) Using %p as front buffer, %p as back buffer\n", This, This->d3d_target, target);
hr = IWineD3DDevice_SetFrontBackBuffers(This->wineD3DDevice,
This->d3d_target->WineD3DSurface,
@ -855,6 +856,15 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
target->WineD3DSurface);
vp.X = 0;
vp.Y = 0;
vp.Width = target->surface_desc.dwWidth;
vp.Height = target->surface_desc.dwHeight;
vp.MinZ = 0.0;
vp.MaxZ = 1.0;
IWineD3DDevice_SetViewport(This->wineD3DDevice,
&vp);
object->OffScreenTarget = TRUE;
}
else