wined3d: Pass a wined3d_color struct to wined3d_device_clear().

This commit is contained in:
Henri Verbeet 2011-11-15 21:18:28 +01:00 committed by Alexandre Julliard
parent 7459180a51
commit e0a0d611af
6 changed files with 43 additions and 29 deletions

View file

@ -1200,17 +1200,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(IDirect3DD
return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD Count,
const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil)
static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD rect_count,
const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
{
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, Count, pRects, Flags, Color, Z, Stencil);
iface, rect_count, rects, flags, color, z, stencil);
wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil);
hr = wined3d_device_clear(This->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
return hr;

View file

@ -1218,18 +1218,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_EndScene(IDirect3DD
return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_Clear(IDirect3DDevice9Ex *iface, DWORD Count,
const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil)
static HRESULT WINAPI IDirect3DDevice9Impl_Clear(IDirect3DDevice9Ex *iface, DWORD rect_count,
const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
{
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
HRESULT hr;
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, Count, pRects, Flags, Color, Z, Stencil);
iface, rect_count, rects, flags, color, z, stencil);
/* Note: D3DRECT is compatible with WINED3DRECT */
wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil);
hr = wined3d_device_clear(This->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
return hr;

View file

@ -5065,23 +5065,24 @@ static HRESULT WINAPI IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *ifa
* For details, see IWineD3DDevice::Clear
*
*****************************************************************************/
static HRESULT
IDirect3DDeviceImpl_7_Clear(IDirect3DDevice7 *iface,
DWORD Count,
D3DRECT *Rects,
DWORD Flags,
D3DCOLOR Color,
D3DVALUE Z,
DWORD Stencil)
static HRESULT IDirect3DDeviceImpl_7_Clear(IDirect3DDevice7 *iface, DWORD count,
D3DRECT *rects, DWORD flags, D3DCOLOR color, D3DVALUE z, DWORD stencil)
{
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice7(iface);
HRESULT hr;
TRACE("iface %p, count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %#x.\n",
iface, Count, Rects, Flags, Color, Z, Stencil);
iface, count, rects, flags, color, z, stencil);
wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (RECT *)Rects, Flags, Color, Z, Stencil);
hr = wined3d_device_clear(This->wined3d_device, count, (RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
return hr;

View file

@ -1199,6 +1199,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters)
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_swapchain *swapchain = NULL;
struct wined3d_context *context;
@ -1345,7 +1346,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Clear the screen */
wined3d_device_clear(device, 0, NULL, WINED3DCLEAR_TARGET
| (present_parameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0),
0x00, 1.0f, 0);
&black, 1.0f, 0);
device->d3d_initialized = TRUE;
@ -4025,13 +4026,12 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const
/* Do not call while under the GL lock. */
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, WINED3DCOLOR color, float depth, DWORD stencil)
const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
const struct wined3d_color c = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)};
RECT draw_rect;
TRACE("device %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, color, depth, stencil);
TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil);
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
@ -4057,7 +4057,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&device->fb, rect_count, rects,
&draw_rect, flags, &c, depth, stencil);
&draw_rect, flags, color, depth, stencil);
}
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,

View file

@ -591,10 +591,12 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* (The Max Payne bug has been confirmed on Windows with the debug runtime) */
if (FALSE && swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD)
{
static const struct wined3d_color cyan = {0.0f, 1.0f, 1.0f, 1.0f};
TRACE("Clearing the color buffer with cyan color\n");
wined3d_device_clear(swapchain->device, 0, NULL,
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0f, 0);
WINED3DCLEAR_TARGET, &cyan, 1.0f, 0);
}
if (!swapchain->render_to_fbo && ((swapchain->front_buffer->flags & SFLAG_INSYSMEM)

View file

@ -65,8 +65,6 @@
#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205)
#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)
typedef DWORD WINED3DCOLOR;
typedef enum _WINED3DLIGHTTYPE
{
WINED3DLIGHT_POINT = 1,
@ -2168,7 +2166,7 @@ HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *devic
HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags,
WINED3DCOLOR color, float z, DWORD stencil);
const struct wined3d_color *color, float z, DWORD stencil);
void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color);
HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface,