Henri Verbeet : wined3d: Set the initial viewport in InitStartupStateBlock( ).

Alexandre Julliard julliard at winehq.org
Sat Dec 20 06:35:14 CST 2008


Module: wine
Branch: master
Commit: ef7365a4cdf72a8cde87a00e8b2ed366ffd345a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ef7365a4cdf72a8cde87a00e8b2ed366ffd345a0

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Dec 19 19:21:55 2008 +0100

wined3d: Set the initial viewport in InitStartupStateBlock().

>From 8aa3fb7ceb6fb93abf71520c852403284a9f8c76 Mon Sep 17 00:00:00 2001
From: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri, 19 Dec 2008 19:21:55 +0100
Subject: wined3d: Set the initial viewport in InitStartupStateBlock().

---

 dlls/wined3d/device.c     |   23 -----------------------
 dlls/wined3d/stateblock.c |   12 ++++++++++++
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 09f4739..f4554eb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2181,17 +2181,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
 
     ENTER_GL();
 
-    { /* Set a default viewport */
-        WINED3DVIEWPORT vp;
-        vp.X      = 0;
-        vp.Y      = 0;
-        vp.Width  = pPresentationParameters->BackBufferWidth;
-        vp.Height = pPresentationParameters->BackBufferHeight;
-        vp.MinZ   = 0.0f;
-        vp.MaxZ   = 1.0f;
-        IWineD3DDevice_SetViewport((IWineD3DDevice *)This, &vp);
-    }
-
     /* Initialize the current view state */
     This->view_ident = 1;
     This->contexts[0]->last_was_rhw = 0;
@@ -7081,16 +7070,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
        (pPresentationParameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth ||
         pPresentationParameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight))
     {
-        WINED3DVIEWPORT vp;
         UINT i;
 
-        vp.X = 0;
-        vp.Y = 0;
-        vp.Width = pPresentationParameters->BackBufferWidth;
-        vp.Height = pPresentationParameters->BackBufferHeight;
-        vp.MinZ = 0;
-        vp.MaxZ = 1;
-
         if(!pPresentationParameters->Windowed) {
             DisplayModeChanged = TRUE;
         }
@@ -7104,10 +7085,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
         if(This->auto_depth_stencil_buffer) {
             updateSurfaceDesc((IWineD3DSurfaceImpl *)This->auto_depth_stencil_buffer, pPresentationParameters);
         }
-
-
-        /* Now set the new viewport */
-        IWineD3DDevice_SetViewport(iface, &vp);
     }
 
     if((pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) ||
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index b0cb027..4859262 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1244,6 +1244,8 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
     /* check the return values, because the GetBackBuffer call isn't valid for ddraw */
     hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain);
     if( hr == WINED3D_OK && swapchain != NULL) {
+        WINED3DVIEWPORT vp;
+
         hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
         if( hr == WINED3D_OK && backbuffer != NULL) {
             IWineD3DSurface_GetDesc(backbuffer, &desc);
@@ -1258,6 +1260,16 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
                 ERR("This should never happen, expect rendering issues!\n");
             }
         }
+
+        /* Set the default viewport */
+        vp.X      = 0;
+        vp.Y      = 0;
+        vp.Width  = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferWidth;
+        vp.Height = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferHeight;
+        vp.MinZ   = 0.0f;
+        vp.MaxZ   = 1.0f;
+        IWineD3DDevice_SetViewport(device, &vp);
+
         IWineD3DSwapChain_Release(swapchain);
     }
 




More information about the wine-cvs mailing list