Stefan Dösinger : ddraw: Adjust the d3d viewport when changing the back buffer.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon May 7 15:26:47 CDT 2007
Module: wine
Branch: master
Commit: 742260d418293e57afcb05e8c1fdc71ec4d99258
URL: http://source.winehq.org/git/wine.git/?a=commit;h=742260d418293e57afcb05e8c1fdc71ec4d99258
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sat Apr 28 14:50:15 2007 +0200
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.
---
dlls/ddraw/device.c | 11 +++++++++++
dlls/ddraw/direct3d.c | 10 ++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 30f80ad..42e44d8 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -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.
*/
diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c
index 9f7e136..0ccb2c3 100644
--- a/dlls/ddraw/direct3d.c
+++ b/dlls/ddraw/direct3d.c
@@ -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
More information about the wine-cvs
mailing list