[PATCH 1/4] wined3d: Get rid of the IWineD3DBase requirement for surface_set_container().

Henri Verbeet hverbeet at codeweavers.com
Fri Mar 18 13:10:57 CDT 2011


This made sense back when we needed the container's parent and didn't know the
container's type, but neither of those is true anymore.
---
 dlls/wined3d/cubetexture.c     |    2 +-
 dlls/wined3d/surface.c         |    2 +-
 dlls/wined3d/swapchain.c       |    4 ++--
 dlls/wined3d/texture.c         |    2 +-
 dlls/wined3d/wined3d_private.h |    4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 7866025..af4947c 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -457,7 +457,7 @@ HRESULT cubetexture_init(IWineD3DBaseTextureImpl *texture, UINT edge_length, UIN
                 return hr;
             }
 
-            surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, (IWineD3DBase *)texture);
+            surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, texture);
             surface_set_texture_target((IWineD3DSurfaceImpl *)surface, cube_targets[j]);
             texture->baseTexture.sub_resources[idx] = &((IWineD3DSurfaceImpl *)surface)->resource;
             TRACE("Created surface level %u @ %p.\n", i, surface);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 745bd77..051bedb 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -92,7 +92,7 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
     resource_cleanup(&This->resource);
 }
 
-void surface_set_container(IWineD3DSurfaceImpl *surface, enum wined3d_container_type type, IWineD3DBase *container)
+void surface_set_container(IWineD3DSurfaceImpl *surface, enum wined3d_container_type type, void *container)
 {
     TRACE("surface %p, container %p.\n", surface, container);
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c3b73bf..db42ff8 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -596,7 +596,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
         goto err;
     }
 
-    surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain);
+    surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain);
     if (surface_type == SURFACE_OPENGL)
     {
         surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE);
@@ -711,7 +711,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
                 goto err;
             }
 
-            surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain);
+            surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain);
         }
     }
 
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 90523b6..4604695 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -521,7 +521,7 @@ HRESULT texture_init(IWineD3DBaseTextureImpl *texture, UINT width, UINT height,
             return hr;
         }
 
-        surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, (IWineD3DBase *)texture);
+        surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, texture);
         surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->baseTexture.target);
         texture->baseTexture.sub_resources[i] = &((IWineD3DSurfaceImpl *)surface)->resource;
         TRACE("Created surface level %u @ %p.\n", i, surface);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 65a7c24..19bf0ed 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2044,9 +2044,9 @@ struct wined3d_subresource_container
     enum wined3d_container_type type;
     union
     {
-        struct IWineD3DBase *base;
         struct IWineD3DSwapChainImpl *swapchain;
         struct IWineD3DBaseTextureImpl *texture;
+        void *base;
     } u;
 };
 
@@ -2157,7 +2157,7 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface,
 void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface,
         unsigned int width, unsigned int height) DECLSPEC_HIDDEN;
 void surface_set_container(IWineD3DSurfaceImpl *surface,
-        enum wined3d_container_type type, IWineD3DBase *container) DECLSPEC_HIDDEN;
+        enum wined3d_container_type type, void *container) DECLSPEC_HIDDEN;
 void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
 void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN;
 void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
-- 
1.7.3.4




More information about the wine-patches mailing list