[PATCH 4/5] wined3d: Get rid of the WINED3DCOLORVALUE typedef.

Henri Verbeet hverbeet at codeweavers.com
Tue Nov 15 14:18:27 CST 2011


---
 dlls/d3d10core/device.c           |    2 +-
 dlls/d3d9/device.c                |    2 +-
 dlls/wined3d/arb_program_shader.c |    2 +-
 dlls/wined3d/device.c             |   10 +++++-----
 dlls/wined3d/surface.c            |   10 +++++-----
 dlls/wined3d/utils.c              |    2 +-
 dlls/wined3d/wined3d_private.h    |    9 +++++----
 include/wine/wined3d.h            |   22 +++++++++++-----------
 8 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 698c1ec..45b7c3a 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -385,7 +385,7 @@ static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *i
 {
     struct d3d10_device *This = impl_from_ID3D10Device(iface);
     struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
-    const WINED3DCOLORVALUE color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
+    const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
 
     TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
             iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4768ece..4e8eee1 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1015,7 +1015,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface
 static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface,
         IDirect3DSurface9 *pSurface, const RECT *pRect, D3DCOLOR color)
 {
-    const WINED3DCOLORVALUE c =
+    const struct wined3d_color c =
     {
         ((color >> 16) & 0xff) / 255.0f,
         ((color >>  8) & 0xff) / 255.0f,
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 17c5ba4..9b4659e 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7327,7 +7327,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
 
 /* Do not call while under the GL lock. */
 static HRESULT arbfp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface,
-        const RECT *dst_rect, const WINED3DCOLORVALUE *color)
+        const RECT *dst_rect, const struct wined3d_color *color)
 {
     FIXME("Color filling not implemented by arbfp_blit\n");
     return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index db57c72..fb51b39 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -645,7 +645,7 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
 
 /* Do not call while under the GL lock. */
 HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
-        UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const WINED3DCOLORVALUE *color,
+        UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
         float depth, DWORD stencil)
 {
     const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL;
@@ -956,7 +956,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
     }
     else
     {
-        const WINED3DCOLORVALUE c = {1.0f, 1.0f, 1.0f, 1.0f};
+        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, device->logo_surface, NULL, &c);
     }
@@ -4027,7 +4027,7 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const
 HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
         const RECT *rects, DWORD flags, WINED3DCOLOR color, float depth, DWORD stencil)
 {
-    const WINED3DCOLORVALUE c = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)};
+    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",
@@ -4780,7 +4780,7 @@ HRESULT CDECL wined3d_device_delete_patch(struct wined3d_device *device, UINT ha
 
 /* Do not call while under the GL lock. */
 HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device,
-        struct wined3d_surface *surface, const RECT *rect, const WINED3DCOLORVALUE *color)
+        struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color)
 {
     RECT r;
 
@@ -4805,7 +4805,7 @@ HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device,
 
 /* Do not call while under the GL lock. */
 void CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
-        struct wined3d_rendertarget_view *rendertarget_view, const WINED3DCOLORVALUE *color)
+        struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color)
 {
     struct wined3d_resource *resource;
     HRESULT hr;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f354c11..865f83e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1283,7 +1283,7 @@ static BOOL primary_render_target_is_p8(const struct wined3d_device *device)
 }
 
 static BOOL surface_convert_color_to_float(const struct wined3d_surface *surface,
-        DWORD color, WINED3DCOLORVALUE *float_color)
+        DWORD color, struct wined3d_color *float_color)
 {
     const struct wined3d_format *format = surface->resource.format;
     const struct wined3d_device *device = surface->resource.device;
@@ -1652,7 +1652,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
 
         if (flags & WINEDDBLT_COLORFILL)
         {
-            WINED3DCOLORVALUE color;
+            struct wined3d_color color;
 
             TRACE("Color fill.\n");
 
@@ -5290,7 +5290,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
 }
 
 /* Do not call while under the GL lock. */
-HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color)
+HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color)
 {
     struct wined3d_device *device = s->resource.device;
     const struct blit_shader *blitter;
@@ -6330,7 +6330,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
 
 /* Do not call while under the GL lock. */
 static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface,
-        const RECT *dst_rect, const WINED3DCOLORVALUE *color)
+        const RECT *dst_rect, const struct wined3d_color *color)
 {
     const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
     struct wined3d_fb_state fb = {&dst_surface, NULL};
@@ -7057,7 +7057,7 @@ release:
 
 /* Do not call while under the GL lock. */
 static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface,
-        const RECT *dst_rect, const WINED3DCOLORVALUE *color)
+        const RECT *dst_rect, const struct wined3d_color *color)
 {
     static const RECT src_rect;
     WINEDDBLTFX BltFx;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index d61172e..f2f8020 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2708,7 +2708,7 @@ BOOL getDepthStencilBits(const struct wined3d_format *format, BYTE *depthSize, B
 /* Note: It's the caller's responsibility to ensure values can be expressed
  * in the requested format. UNORM formats for example can only express values
  * in the range 0.0f -> 1.0f. */
-DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, const WINED3DCOLORVALUE *color)
+DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, const struct wined3d_color *color)
 {
     static const struct
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b8f3e84..1da2240 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1206,7 +1206,7 @@ struct blit_shader
             const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
             const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format);
     HRESULT (*color_fill)(struct wined3d_device *device, struct wined3d_surface *dst_surface,
-            const RECT *dst_rect, const WINED3DCOLORVALUE *color);
+            const RECT *dst_rect, const struct wined3d_color *color);
     HRESULT (*depth_fill)(struct wined3d_device *device,
             struct wined3d_surface *surface, const RECT *rect, float depth);
 };
@@ -1757,7 +1757,7 @@ struct wined3d_device
 
 HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
         UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags,
-        const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
+        const struct wined3d_color *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;
 HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -2073,7 +2073,8 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
 
 void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect) DECLSPEC_HIDDEN;
 void surface_bind(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
-HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
+HRESULT surface_color_fill(struct wined3d_surface *s,
+        const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
 GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 BOOL surface_init_sysmem(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
@@ -2823,7 +2824,7 @@ const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl
 UINT wined3d_format_calculate_size(const struct wined3d_format *format,
         UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN;
 DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface,
-        const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
+        const struct wined3d_color *color) DECLSPEC_HIDDEN;
 
 static inline BOOL use_vs(const struct wined3d_state *state)
 {
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index f3bb3dc..c1dbaa3 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1519,13 +1519,13 @@ typedef struct _WINED3DDISPLAYMODE
     enum wined3d_format_id Format;
 } WINED3DDISPLAYMODE;
 
-typedef struct _WINED3DCOLORVALUE
+struct wined3d_color
 {
     float r;
     float g;
     float b;
     float a;
-} WINED3DCOLORVALUE;
+};
 
 typedef struct _WINED3DVECTOR
 {
@@ -1552,9 +1552,9 @@ typedef struct _WINED3DMATRIX
 typedef struct _WINED3DLIGHT
 {
     WINED3DLIGHTTYPE Type;
-    WINED3DCOLORVALUE Diffuse;
-    WINED3DCOLORVALUE Specular;
-    WINED3DCOLORVALUE Ambient;
+    struct wined3d_color Diffuse;
+    struct wined3d_color Specular;
+    struct wined3d_color Ambient;
     WINED3DVECTOR Position;
     WINED3DVECTOR Direction;
     float Range;
@@ -1568,10 +1568,10 @@ typedef struct _WINED3DLIGHT
 
 typedef struct _WINED3DMATERIAL
 {
-    WINED3DCOLORVALUE Diffuse;
-    WINED3DCOLORVALUE Ambient;
-    WINED3DCOLORVALUE Specular;
-    WINED3DCOLORVALUE Emissive;
+    struct wined3d_color Diffuse;
+    struct wined3d_color Ambient;
+    struct wined3d_color Specular;
+    struct wined3d_color Emissive;
     float Power;
 } WINED3DMATERIAL;
 
@@ -2170,9 +2170,9 @@ 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);
 void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
-        struct wined3d_rendertarget_view *rendertarget_view, const WINED3DCOLORVALUE *color);
+        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 WINED3DCOLORVALUE *color);
+        const RECT *rect, const struct wined3d_color *color);
 HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
         WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment,
         struct wined3d_device_parent *device_parent, struct wined3d_device **device);
-- 
1.7.3.4




More information about the wine-patches mailing list