[PATCH 4/4] wined3d: Get rid of the IWineD3D typedefs.

Henri Verbeet hverbeet at codeweavers.com
Tue Feb 1 12:39:54 CST 2011


---
 dlls/wined3d/device.c          |    4 ++--
 dlls/wined3d/directx.c         |   39 +++++++++++++++++++--------------------
 dlls/wined3d/resource.c        |    2 +-
 dlls/wined3d/surface.c         |    2 +-
 dlls/wined3d/wined3d_main.c    |    4 ++--
 dlls/wined3d/wined3d_private.h |    8 +++-----
 6 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 381cd46..a63959a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -6928,7 +6928,7 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
     IWineD3DDeviceImpl_RestoreFullscreenWindow,
 };
 
-HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
+HRESULT device_init(IWineD3DDeviceImpl *device, struct wined3d *wined3d,
         UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
         IWineD3DDeviceParent *device_parent)
 {
@@ -6942,7 +6942,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
 
     device->lpVtbl = &IWineD3DDevice_Vtbl;
     device->ref = 1;
-    device->wined3d = (IWineD3D *)wined3d;
+    device->wined3d = wined3d;
     wined3d_incref(device->wined3d);
     device->adapter = wined3d->adapter_count ? adapter : NULL;
     device->device_parent = device_parent;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 68edd41..899011e 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4983,7 +4983,7 @@ static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info)
 }
 
 /* Do not call while under the GL lock. */
-static BOOL InitAdapters(IWineD3DImpl *This)
+static BOOL InitAdapters(struct wined3d *wined3d)
 {
     static HMODULE mod_gl;
     BOOL ret;
@@ -5040,7 +5040,7 @@ static BOOL InitAdapters(IWineD3DImpl *This)
 
     /* For now only one default adapter */
     {
-        struct wined3d_adapter *adapter = &This->adapters[0];
+        struct wined3d_adapter *adapter = &wined3d->adapters[0];
         const struct wined3d_gl_info *gl_info = &adapter->gl_info;
         struct wined3d_fake_gl_ctx fake_gl_ctx = {0};
         int iPixelFormat;
@@ -5246,30 +5246,29 @@ static BOOL InitAdapters(IWineD3DImpl *This)
         fillGLAttribFuncs(&adapter->gl_info);
         adapter->opengl = TRUE;
     }
-    This->adapter_count = 1;
-    TRACE("%u adapters successfully initialized\n", This->adapter_count);
+    wined3d->adapter_count = 1;
+    TRACE("%u adapters successfully initialized.\n", wined3d->adapter_count);
 
     return TRUE;
 
 nogl_adapter:
     /* Initialize an adapter for ddraw-only memory counting */
-    memset(This->adapters, 0, sizeof(This->adapters));
-    This->adapters[0].ordinal = 0;
-    This->adapters[0].opengl = FALSE;
-    This->adapters[0].monitorPoint.x = -1;
-    This->adapters[0].monitorPoint.y = -1;
-
-    This->adapters[0].driver_info.name = "Display";
-    This->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation";
-    if(wined3d_settings.emulated_textureram) {
-        This->adapters[0].TextureRam = wined3d_settings.emulated_textureram;
-    } else {
-        This->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
-    }
+    memset(wined3d->adapters, 0, sizeof(wined3d->adapters));
+    wined3d->adapters[0].ordinal = 0;
+    wined3d->adapters[0].opengl = FALSE;
+    wined3d->adapters[0].monitorPoint.x = -1;
+    wined3d->adapters[0].monitorPoint.y = -1;
+
+    wined3d->adapters[0].driver_info.name = "Display";
+    wined3d->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation";
+    if (wined3d_settings.emulated_textureram)
+        wined3d->adapters[0].TextureRam = wined3d_settings.emulated_textureram;
+    else
+        wined3d->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
 
-    initPixelFormatsNoGL(&This->adapters[0].gl_info);
+    initPixelFormatsNoGL(&wined3d->adapters[0].gl_info);
 
-    This->adapter_count = 1;
+    wined3d->adapter_count = 1;
     return FALSE;
 }
 
@@ -5281,7 +5280,7 @@ const struct wined3d_parent_ops wined3d_null_parent_ops =
 };
 
 /* Do not call while under the GL lock. */
-HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent)
+HRESULT wined3d_init(struct wined3d *wined3d, UINT version, void *parent)
 {
     wined3d->dxVersion = version;
     wined3d->ref = 1;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 623706f..edc3f8b 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -210,7 +210,7 @@ HRESULT resource_get_private_data(struct IWineD3DResourceImpl *resource, REFGUID
     if (d->flags & WINED3DSPD_IUNKNOWN)
     {
         *(IUnknown **)data = d->ptr.object;
-        if (((IWineD3DImpl *)resource->resource.device->wined3d)->dxVersion != 7)
+        if (resource->resource.device->wined3d->dxVersion != 7)
         {
             /* D3D8 and D3D9 addref the private data, DDraw does not. This
              * can't be handled in ddraw because it doesn't know if the
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 841662f..20930c4 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2384,7 +2384,7 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL
 
     if (!pal)
     {
-        UINT dxVersion = ((IWineD3DImpl *)device->wined3d)->dxVersion;
+        UINT dxVersion = device->wined3d->dxVersion;
 
         /* In DirectDraw the palette is a property of the surface, there are no such things as device palettes. */
         if (dxVersion <= 7)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index c46ffe2..532314c 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -80,7 +80,7 @@ wined3d_settings_t wined3d_settings =
 /* Do not call while under the GL lock. */
 struct wined3d * CDECL wined3d_create(UINT version, void *parent)
 {
-    IWineD3DImpl *object;
+    struct wined3d *object;
     HRESULT hr;
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
@@ -100,7 +100,7 @@ struct wined3d * CDECL wined3d_create(UINT version, void *parent)
 
     TRACE("Created wined3d object %p for d3d%d support.\n", object, version);
 
-    return (IWineD3D *)object;
+    return object;
 }
 
 static DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5d4ad04..6af34e1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -59,8 +59,6 @@ typedef struct IWineD3DSwapChainImpl  IWineD3DSwapChainImpl;
 struct IWineD3DBaseShaderImpl;
 struct IWineD3DBaseTextureImpl;
 struct IWineD3DResourceImpl;
-typedef struct wined3d IWineD3DImpl;
-typedef struct wined3d IWineD3D;
 
 /* Texture format fixups */
 
@@ -1622,7 +1620,7 @@ struct wined3d
     struct wined3d_adapter adapters[1];
 };
 
-HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN;
+HRESULT wined3d_init(struct wined3d *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN;
 BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
 void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
 
@@ -1642,7 +1640,7 @@ struct IWineD3DDeviceImpl
 
     /* WineD3D Information  */
     IWineD3DDeviceParent   *device_parent;
-    IWineD3D *wined3d;
+    struct wined3d *wined3d;
     struct wined3d_adapter *adapter;
 
     /* Window styles to restore when switching fullscreen mode */
@@ -1770,7 +1768,7 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I
 BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) DECLSPEC_HIDDEN;
-HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
+HRESULT device_init(IWineD3DDeviceImpl *device, struct wined3d *wined3d,
         UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
         IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN;
 void device_preload_textures(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
-- 
1.7.3.4




More information about the wine-patches mailing list