Module: wine Branch: master Commit: 864b25e58297f79c3c7f8e4ca349499265fbd9e5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=864b25e58297f79c3c7f8e4ca3...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Sep 23 10:26:44 2013 +0200
wined3d: Introduce a separate function for updating the viewport and scissor rects.
---
dlls/wined3d/device.c | 21 +++++++++++++++++++++ dlls/wined3d/stateblock.c | 17 ----------------- 2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 58c3db1..158305b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -827,6 +827,23 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device) InterlockedExchangePointer((void **)&device->focus_window, NULL); }
+static void device_reset_viewport_scissor(struct wined3d_device *device, UINT width, UINT height) +{ + struct wined3d_state *state = &device->state; + + state->viewport.x = 0; + state->viewport.y = 0; + state->viewport.width = width; + state->viewport.height = height; + state->viewport.min_z = 0.0f; + state->viewport.max_z = 1.0f; + + state->scissor_rect.left = 0; + state->scissor_rect.top = 0; + state->scissor_rect.right = width; + state->scissor_rect.bottom = height; +} + HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc) { @@ -895,6 +912,8 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Setup all the devices defaults */ state_init_default(&device->state, device); + device_reset_viewport_scissor(device, swapchain->desc.backbuffer_width, + swapchain->desc.backbuffer_height);
context = context_acquire(device, swapchain->front_buffer);
@@ -4704,6 +4723,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (FAILED(hr = state_init(&device->state, &device->adapter->d3d_info))) ERR("Failed to initialize device state, hr %#x.\n", hr); state_init_default(&device->state, device); + device_reset_viewport_scissor(device, swapchain->desc.backbuffer_width, + swapchain->desc.backbuffer_height); device->update_state = &device->state; } else diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index c2a5208..c593a63 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1181,7 +1181,6 @@ void state_init_default(struct wined3d_state *state, struct wined3d_device *devi DWORD d; } tmpfloat; unsigned int i; - struct wined3d_swapchain_desc *swapchain_desc; static const struct wined3d_matrix identity = {{{ 1.0f, 0.0f, 0.0f, 0.0f, @@ -1384,22 +1383,6 @@ void state_init_default(struct wined3d_state *state, struct wined3d_device *devi { state->textures[i] = NULL; } - - swapchain_desc = &device->swapchains[0]->desc; - - /* 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; - - /* 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,