Henri Verbeet : wined3d: Get rid of wined3d_device_color_fill().

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 22 13:48:40 CDT 2014


Module: wine
Branch: master
Commit: 736b9e1c1c4ae3caf7b0dc78b5ffaef8b00cc954
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=736b9e1c1c4ae3caf7b0dc78b5ffaef8b00cc954

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Aug 22 12:32:02 2014 +0200

wined3d: Get rid of wined3d_device_color_fill().

---

 dlls/d3d10core/device.c   |  8 ++++---
 dlls/d3d9/device.c        | 10 +++++++--
 dlls/wined3d/device.c     | 54 ++++++++++++++++-------------------------------
 dlls/wined3d/wined3d.spec |  3 +--
 include/wine/wined3d.h    |  6 ++----
 5 files changed, 34 insertions(+), 47 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index ac43ca6..9668964 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -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,
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2d05e11..7b9b635 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -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();
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 796d995..9df422f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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,
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 2b4236b..0ee16c4 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -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)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index ca4a6af..6dda931 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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,




More information about the wine-cvs mailing list