Henri Verbeet : wined3d: Set the default scissor rect from the swapchain desc in state_init_default ().

Alexandre Julliard julliard at winehq.org
Fri Sep 20 14:21:30 CDT 2013


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Sep 20 10:41:45 2013 +0200

wined3d: Set the default scissor rect from the swapchain desc in state_init_default().

We always have a swapchain here, even if there are no back buffers.

---

 dlls/wined3d/stateblock.c |   40 ++++++++++++++--------------------------
 1 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 00ab69a..c2a5208 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1181,8 +1181,7 @@ void state_init_default(struct wined3d_state *state, struct wined3d_device *devi
         DWORD d;
     } tmpfloat;
     unsigned int i;
-    struct wined3d_swapchain *swapchain;
-    struct wined3d_surface *backbuffer;
+    struct wined3d_swapchain_desc *swapchain_desc;
     static const struct wined3d_matrix identity =
     {{{
         1.0f, 0.0f, 0.0f, 0.0f,
@@ -1386,32 +1385,21 @@ void state_init_default(struct wined3d_state *state, struct wined3d_device *devi
         state->textures[i] = NULL;
     }
 
-    /* check the return values, because the GetBackBuffer call isn't valid for ddraw */
-    if ((swapchain = wined3d_device_get_swapchain(device, 0)))
-    {
-        if ((backbuffer = wined3d_swapchain_get_back_buffer(swapchain, 0, WINED3D_BACKBUFFER_TYPE_MONO)))
-        {
-            struct wined3d_resource_desc desc;
-
-            wined3d_resource_get_desc(&backbuffer->resource, &desc);
+    swapchain_desc = &device->swapchains[0]->desc;
 
-            /* Set the default scissor rect values */
-            state->scissor_rect.left = 0;
-            state->scissor_rect.right = desc.width;
-            state->scissor_rect.top = 0;
-            state->scissor_rect.bottom = desc.height;
-        }
-
-        /* Set the default viewport */
-        state->viewport.x = 0;
-        state->viewport.y = 0;
-        state->viewport.width = swapchain->desc.backbuffer_width;
-        state->viewport.height = swapchain->desc.backbuffer_height;
-        state->viewport.min_z = 0.0f;
-        state->viewport.max_z = 1.0f;
-    }
+    /* Set the default scissor rect values */
+    state->scissor_rect.left = 0;
+    state->scissor_rect.right = swapchain_desc->backbuffer_width;
+    state->scissor_rect.top = 0;
+    state->scissor_rect.bottom = swapchain_desc->backbuffer_height;
 
-    TRACE("Done.\n");
+    /* Set the default viewport */
+    state->viewport.x = 0;
+    state->viewport.y = 0;
+    state->viewport.width = swapchain_desc->backbuffer_width;
+    state->viewport.height = swapchain_desc->backbuffer_height;
+    state->viewport.min_z = 0.0f;
+    state->viewport.max_z = 1.0f;
 }
 
 static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,




More information about the wine-cvs mailing list