From c0aa053a879980ffedbd049c27dd2ca37136b890 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 5 Jul 2011 22:30:57 +0200 Subject: [PATCH] wined3d: Pass a state pointer instead of a device pointer to device_get_draw_rect(). --- dlls/wined3d/device.c | 15 +-------------- dlls/wined3d/drawprim.c | 2 +- dlls/wined3d/utils.c | 10 ++++++++++ dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f9b41d0d48e..a7e578a23fc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -557,19 +557,6 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context device->contexts = new_array; } -void device_get_draw_rect(struct wined3d_device *device, RECT *rect) -{ - struct wined3d_stateblock *stateblock = device->stateBlock; - WINED3DVIEWPORT *vp = &stateblock->state.viewport; - - SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height); - - if (stateblock->state.render_states[WINED3DRS_SCISSORTESTENABLE]) - { - IntersectRect(rect, rect, &stateblock->state.scissor_rect); - } -} - /* Do not call while under the GL lock. */ void device_switch_onscreen_ds(struct wined3d_device *device, struct wined3d_context *context, struct wined3d_surface *depth_stencil) @@ -4040,7 +4027,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } } - device_get_draw_rect(device, &draw_rect); + wined3d_get_draw_rect(&device->stateBlock->state, &draw_rect); return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, &device->fb, rect_count, rects, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 3d867822176..58babb4ebea 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -639,7 +639,7 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId else SetRectEmpty(¤t_rect); - device_get_draw_rect(device, &draw_rect); + wined3d_get_draw_rect(state, &draw_rect); IntersectRect(&r, &draw_rect, ¤t_rect); if (!EqualRect(&r, &draw_rect)) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 9a76f0022cc..4d9a9a3d6df 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3246,3 +3246,13 @@ const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *g return NULL; } + +void wined3d_get_draw_rect(const struct wined3d_state *state, RECT *rect) +{ + const WINED3DVIEWPORT *vp = &state->viewport; + + SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height); + + if (state->render_states[WINED3DRS_SCISSORTESTENABLE]) + IntersectRect(rect, rect, &state->scissor_rect); +} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4984d16ccd8..4000ed2d4f5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1596,6 +1596,7 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_settings *settings) DECLSPEC_HIDDEN; void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) DECLSPEC_HIDDEN; +void wined3d_get_draw_rect(const struct wined3d_state *state, RECT *rect) DECLSPEC_HIDDEN; struct wined3d { @@ -1749,7 +1750,6 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; -void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN; HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent) DECLSPEC_HIDDEN;