Commit 736b9e1c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of wined3d_device_color_fill().

parent 07985a8c
......@@ -535,14 +535,16 @@ static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device1 *ifac
static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device1 *iface,
ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
{
struct d3d10_device *This = impl_from_ID3D10Device(iface);
struct d3d10_device *device = impl_from_ID3D10Device(iface);
struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
HRESULT hr;
TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
TRACE("iface %p, render_target_view %p, color_rgba {%.8e, %.8e, %.8e, %.8e}.\n",
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color)))
ERR("Failed to clear view, hr %#x.\n", hr);
}
static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device1 *iface,
......
......@@ -1271,8 +1271,14 @@ static HRESULT WINAPI d3d9_device_ColorFill(IDirect3DDevice9Ex *iface,
return D3DERR_INVALIDCALL;
}
/* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */
hr = wined3d_device_color_fill(device->wined3d_device, surface_impl->wined3d_surface, rect, &c);
if (desc.pool != WINED3D_POOL_DEFAULT && desc.pool != WINED3D_POOL_SYSTEM_MEM)
{
WARN("Color-fill not allowed on surfaces in pool %#x.\n", desc.pool);
return D3DERR_INVALIDCALL;
}
hr = wined3d_device_clear_rendertarget_view(device->wined3d_device,
d3d9_surface_get_rendertarget_view(surface_impl), rect, &c);
wined3d_mutex_unlock();
......
......@@ -609,9 +609,11 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
}
else
{
const RECT rect = {0, 0, surface->resource.width, surface->resource.height};
const struct wined3d_color c = {1.0f, 1.0f, 1.0f, 1.0f};
/* Fill the surface with a white color to show that wined3d is there */
wined3d_device_color_fill(device, surface, NULL, &c);
surface_color_fill(surface, &rect, &c);
}
out:
......@@ -3658,30 +3660,6 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
return surface_upload_from_surface(dst_surface, dst_point, src_surface, src_rect);
}
HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device,
struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color)
{
RECT r;
TRACE("device %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
device, surface, wine_dbgstr_rect(rect),
color->r, color->g, color->b, color->a);
if (surface->resource.pool != WINED3D_POOL_DEFAULT && surface->resource.pool != WINED3D_POOL_SYSTEM_MEM)
{
WARN("Color-fill not allowed on %s surfaces.\n", debug_d3dpool(surface->resource.pool));
return WINED3DERR_INVALIDCALL;
}
if (!rect)
{
SetRect(&r, 0, 0, surface->resource.width, surface->resource.height);
rect = &r;
}
return surface_color_fill(surface, rect, color);
}
void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource)
{
......@@ -3753,33 +3731,37 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
}
}
void CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *view, const struct wined3d_color *color)
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color)
{
struct wined3d_resource *resource;
HRESULT hr;
RECT rect;
RECT r;
TRACE("device %p, view %p, color {%.8e, %.8e, %.8e, %.8e}.\n",
device, view, color->r, color->g, color->b, color->a);
TRACE("device %p, view %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
device, view, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a);
resource = view->resource;
if (resource->type != WINED3D_RTYPE_TEXTURE && resource->type != WINED3D_RTYPE_CUBE_TEXTURE)
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
return;
return WINED3DERR_INVALIDCALL;
}
if (view->depth > 1)
{
FIXME("Layered clears not implemented.\n");
return;
return WINED3DERR_INVALIDCALL;
}
if (!rect)
{
SetRect(&r, 0, 0, view->width, view->height);
rect = &r;
}
SetRect(&rect, 0, 0, view->width, view->height);
resource = wined3d_texture_get_sub_resource(wined3d_texture_from_resource(resource), view->sub_resource_idx);
if (FAILED(hr = surface_color_fill(surface_from_resource(resource), &rect, color)))
ERR("Color fill failed, hr %#x.\n", hr);
return surface_color_fill(surface_from_resource(resource), rect, color);
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
......
......@@ -36,8 +36,7 @@
@ cdecl wined3d_device_begin_scene(ptr)
@ cdecl wined3d_device_begin_stateblock(ptr)
@ cdecl wined3d_device_clear(ptr long ptr long ptr float long)
@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr)
@ cdecl wined3d_device_color_fill(ptr ptr ptr ptr)
@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr ptr)
@ cdecl wined3d_device_copy_resource(ptr ptr ptr)
@ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr)
@ cdecl wined3d_device_decref(ptr)
......
......@@ -2095,10 +2095,8 @@ 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,
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,
const RECT *rect, const struct wined3d_color *color);
HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color);
void __cdecl wined3d_device_copy_resource(struct wined3d_device *device,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource);
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment