From 937eb7e600b963e77a8e9ba3182b52d6b7ab6283 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 15 Sep 2010 12:00:05 +0200 Subject: [PATCH] wined3d: Move the scissor rect to wined3d_state. --- dlls/wined3d/device.c | 19 ++++++++++--------- dlls/wined3d/state.c | 2 +- dlls/wined3d/stateblock.c | 8 ++++---- dlls/wined3d/wined3d_private.h | 5 ++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index fb9bcdb825..3bf1eac72a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -567,7 +567,7 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) if (stateblock->state.render_states[WINED3DRS_SCISSORTESTENABLE]) { - IntersectRect(rect, rect, &stateblock->scissorRect); + IntersectRect(rect, rect, &stateblock->state.scissor_rect); } } @@ -3138,11 +3138,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; This->updateStateBlock->changed.scissorRect = TRUE; - if(EqualRect(&This->updateStateBlock->scissorRect, pRect)) { - TRACE("App is setting the old scissor rectangle over, nothing to do\n"); + if (EqualRect(&This->updateStateBlock->state.scissor_rect, pRect)) + { + TRACE("App is setting the old scissor rectangle over, nothing to do.\n"); return WINED3D_OK; } - CopyRect(&This->updateStateBlock->scissorRect, pRect); + CopyRect(&This->updateStateBlock->state.scissor_rect, pRect); if(This->isRecordingState) { TRACE("Recording... not performing anything\n"); @@ -3157,7 +3158,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C static HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - *pRect = This->updateStateBlock->scissorRect; + *pRect = This->updateStateBlock->state.scissor_rect; TRACE("(%p)Returning a Scissor Rect of %d:%d-%d:%d\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom); return WINED3D_OK; } @@ -5759,10 +5760,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, device->stateBlock->viewport.MinZ = 0.0f; IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT); - device->stateBlock->scissorRect.top = 0; - device->stateBlock->scissorRect.left = 0; - device->stateBlock->scissorRect.right = device->stateBlock->viewport.Width; - device->stateBlock->scissorRect.bottom = device->stateBlock->viewport.Height; + device->stateBlock->state.scissor_rect.top = 0; + device->stateBlock->state.scissor_rect.left = 0; + device->stateBlock->state.scissor_rect.right = device->stateBlock->viewport.Width; + device->stateBlock->state.scissor_rect.bottom = device->stateBlock->viewport.Height; IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT); } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 4d17cf330c..ebd89b3c03 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4880,7 +4880,7 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3 static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; - RECT *pRect = &stateblock->scissorRect; + RECT *pRect = &stateblock->state.scissor_rect; UINT height; UINT width; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 6eb4713251..3f20ae52ed 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -755,12 +755,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) This->viewport = targetStateBlock->viewport; } - if(This->changed.scissorRect - && memcmp(&targetStateBlock->scissorRect, &This->scissorRect, sizeof(This->scissorRect))) + if (This->changed.scissorRect && memcmp(&targetStateBlock->state.scissor_rect, + &This->state.scissor_rect, sizeof(This->state.scissor_rect))) { TRACE("Updating scissor rect.\n"); - This->scissorRect = targetStateBlock->scissorRect; + This->state.scissor_rect = targetStateBlock->state.scissor_rect; } map = This->changed.streamSource; @@ -1000,7 +1000,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface) if (This->changed.scissorRect) { - IWineD3DDevice_SetScissorRect(device, &This->scissorRect); + IWineD3DDevice_SetScissorRect(device, &This->state.scissor_rect); } map = This->changed.streamSource; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index dd357c2682..ed8ea557bf 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2349,6 +2349,8 @@ struct wined3d_stream_state struct wined3d_state { + RECT scissor_rect; + DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -2425,9 +2427,6 @@ struct IWineD3DStateBlockImpl /* Sampler States */ DWORD samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; - /* Scissor test rectangle */ - RECT scissorRect; - /* Contained state management */ DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1]; unsigned int num_contained_render_states;