wined3d: Pass a state pointer instead of a device pointer to device_get_draw_rect().

This commit is contained in:
Henri Verbeet 2011-07-05 22:30:57 +02:00 committed by Alexandre Julliard
parent a7120866be
commit c0aa053a87
4 changed files with 13 additions and 16 deletions

View file

@ -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,

View file

@ -639,7 +639,7 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId
else
SetRectEmpty(&current_rect);
device_get_draw_rect(device, &draw_rect);
wined3d_get_draw_rect(state, &draw_rect);
IntersectRect(&r, &draw_rect, &current_rect);
if (!EqualRect(&r, &draw_rect))

View file

@ -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);
}

View file

@ -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;