[PATCH 4/5] d3d8: Get rid of IDirect3DSurface8Impl.

Henri Verbeet hverbeet at codeweavers.com
Wed May 23 11:14:33 CDT 2012


---
 dlls/d3d8/d3d8_private.h |   18 ++----
 dlls/d3d8/device.c       |   37 +++++------
 dlls/d3d8/surface.c      |  163 ++++++++++++++++++++++++----------------------
 dlls/d3d8/swapchain.c    |    2 +-
 dlls/d3d8/texture.c      |   12 ++--
 5 files changed, 114 insertions(+), 118 deletions(-)

diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index cca05ea..c9c604d 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -100,7 +100,6 @@
 
 void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
 
-typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
 typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
 
 struct d3d8
@@ -199,19 +198,12 @@ struct d3d8_swapchain
 HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device,
         D3DPRESENT_PARAMETERS *present_parameters) DECLSPEC_HIDDEN;
 
-/* ----------------- */
-/* IDirect3DSurface8 */
-/* ----------------- */
-
-/*****************************************************************************
- * IDirect3DSurface8 implementation structure
- */
-struct IDirect3DSurface8Impl
+struct d3d8_surface
 {
     IDirect3DSurface8 IDirect3DSurface8_iface;
-    LONG ref;
+    LONG refcount;
     struct wined3d_surface *wined3d_surface;
-    IDirect3DDevice8 *parentDevice;
+    IDirect3DDevice8 *parent_device;
 
     /* The surface container */
     IUnknown                    *container;
@@ -220,10 +212,10 @@ struct IDirect3DSurface8Impl
     IUnknown                    *forwardReference;
 };
 
-HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
+HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device,
         UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
         DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
-IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
+struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
 
 struct d3d8_vertexbuffer
 {
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 837e847..ddf5c1f 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -449,7 +449,7 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
         UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
-    IDirect3DSurface8Impl *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap);
+    struct d3d8_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap);
     HRESULT hr;
 
     TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
@@ -532,7 +532,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
     wined3d_resource_get_desc(resource, &desc);
     if (desc.pool == WINED3D_POOL_DEFAULT)
     {
-        IDirect3DSurface8Impl *surface;
+        struct d3d8_surface *surface;
 
         if (desc.resource_type != WINED3D_RTYPE_SURFACE)
         {
@@ -541,7 +541,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
         }
 
         surface = wined3d_resource_get_parent(resource);
-        if (surface->ref)
+        if (surface->refcount)
         {
             WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource);
             return D3DERR_DEVICELOST;
@@ -615,7 +615,7 @@ static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface,
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
     struct wined3d_surface *wined3d_surface = NULL;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
@@ -836,7 +836,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width,
         IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type,
         DWORD multisample_quality)
 {
-    IDirect3DSurface8Impl *object;
+    struct d3d8_surface *object;
     HRESULT hr;
 
     TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n"
@@ -844,8 +844,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width,
             device, width, height, format, lockable, discard, level, surface,
             usage, pool, multisample_type, multisample_quality);
 
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl));
-    if (!object)
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
     {
         FIXME("Failed to allocate surface memory.\n");
         return D3DERR_OUTOFVIDEOMEMORY;
@@ -920,8 +919,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
         IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count,
         IDirect3DSurface8 *dst_surface, const POINT *dst_points)
 {
-    IDirect3DSurface8Impl *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
-    IDirect3DSurface8Impl *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
+    struct d3d8_surface *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
+    struct d3d8_surface *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
     enum wined3d_format_id src_format, dst_format;
     struct wined3d_resource_desc wined3d_desc;
     struct wined3d_resource *wined3d_resource;
@@ -1042,7 +1041,7 @@ static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface,
 static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
-    IDirect3DSurface8Impl *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
+    struct d3d8_surface *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
     HRESULT hr;
 
     TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
@@ -1064,8 +1063,8 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
         IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
-    IDirect3DSurface8Impl *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
-    IDirect3DSurface8Impl *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
+    struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
+    struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
     struct wined3d_surface *original_ds = NULL;
     HRESULT hr;
 
@@ -1129,7 +1128,7 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDire
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
     struct wined3d_surface *wined3d_surface;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, render_target %p.\n", iface, render_target);
@@ -1160,7 +1159,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
     struct wined3d_surface *wined3d_surface;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
@@ -2802,7 +2801,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
         enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
 {
     struct d3d8_device *device = device_from_device_parent(device_parent);
-    IDirect3DSurface8Impl *d3d_surface;
+    struct d3d8_surface *d3d_surface;
     BOOL lockable = TRUE;
     HRESULT hr;
 
@@ -2827,8 +2826,8 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
     wined3d_surface_incref(*surface);
 
     d3d_surface->container = container_parent;
-    IUnknown_Release(d3d_surface->parentDevice);
-    d3d_surface->parentDevice = NULL;
+    IUnknown_Release(d3d_surface->parent_device);
+    d3d_surface->parent_device = NULL;
 
     IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
     d3d_surface->forwardReference = container_parent;
@@ -2842,7 +2841,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
         struct wined3d_surface **surface)
 {
     struct d3d8_device *device = device_from_device_parent(device_parent);
-    IDirect3DSurface8Impl *d3d_surface;
+    struct d3d8_surface *d3d_surface;
     HRESULT hr;
 
     TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
@@ -2873,7 +2872,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
         DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
 {
     struct d3d8_device *device = device_from_device_parent(device_parent);
-    IDirect3DSurface8Impl *d3d_surface;
+    struct d3d8_surface *d3d_surface;
     HRESULT hr;
 
     TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 89597f0..91d263c 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -23,53 +23,55 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
 
-static inline IDirect3DSurface8Impl *impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
+static inline struct d3d8_surface *impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
 {
-    return CONTAINING_RECORD(iface, IDirect3DSurface8Impl, IDirect3DSurface8_iface);
+    return CONTAINING_RECORD(iface, struct d3d8_surface, IDirect3DSurface8_iface);
 }
 
-/* IDirect3DSurface8 IUnknown parts follow: */
-static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(IDirect3DSurface8 *iface, REFIID riid,
-        void **ppobj)
+static HRESULT WINAPI d3d8_surface_QueryInterface(IDirect3DSurface8 *iface, REFIID riid, void **out)
 {
-    TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
+    TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), out);
 
     if (IsEqualGUID(riid, &IID_IDirect3DSurface8)
             || IsEqualGUID(riid, &IID_IDirect3DResource8)
             || IsEqualGUID(riid, &IID_IUnknown))
     {
         IUnknown_AddRef(iface);
-        *ppobj = iface;
+        *out = iface;
         return S_OK;
     }
 
     WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
 
-    *ppobj = NULL;
+    *out = NULL;
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI IDirect3DSurface8Impl_AddRef(IDirect3DSurface8 *iface)
+static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
 
     TRACE("iface %p.\n", iface);
 
-    if (This->forwardReference) {
+    if (surface->forwardReference)
+    {
         /* Forward refcounting */
-        TRACE("(%p) : Forwarding to %p\n", This, This->forwardReference);
-        return IUnknown_AddRef(This->forwardReference);
-    } else {
+        TRACE("Forwarding to %p.\n", surface->forwardReference);
+        return IUnknown_AddRef(surface->forwardReference);
+    }
+    else
+    {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedIncrement(&This->ref);
+        ULONG ref = InterlockedIncrement(&surface->refcount);
 
         TRACE("%p increasing refcount to %u.\n", iface, ref);
 
         if (ref == 1)
         {
-            if (This->parentDevice) IUnknown_AddRef(This->parentDevice);
+            if (surface->parent_device)
+                IUnknown_AddRef(surface->parent_device);
             wined3d_mutex_lock();
-            wined3d_surface_incref(This->wined3d_surface);
+            wined3d_surface_incref(surface->wined3d_surface);
             wined3d_mutex_unlock();
         }
 
@@ -77,51 +79,54 @@ static ULONG WINAPI IDirect3DSurface8Impl_AddRef(IDirect3DSurface8 *iface)
     }
 }
 
-static ULONG WINAPI IDirect3DSurface8Impl_Release(IDirect3DSurface8 *iface)
+static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
 
     TRACE("iface %p.\n", iface);
 
-    if (This->forwardReference) {
+    if (surface->forwardReference)
+    {
         /* Forward refcounting */
-        TRACE("(%p) : Forwarding to %p\n", This, This->forwardReference);
-        return IUnknown_Release(This->forwardReference);
-    } else {
+        TRACE("Forwarding to %p.\n", surface->forwardReference);
+        return IUnknown_Release(surface->forwardReference);
+    }
+    else
+    {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedDecrement(&This->ref);
+        ULONG ref = InterlockedDecrement(&surface->refcount);
 
         TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
-        if (ref == 0) {
-            IDirect3DDevice8 *parentDevice = This->parentDevice;
+        if (!ref)
+        {
+            IDirect3DDevice8 *parent_device = surface->parent_device;
 
             /* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */
             wined3d_mutex_lock();
-            wined3d_surface_decref(This->wined3d_surface);
+            wined3d_surface_decref(surface->wined3d_surface);
             wined3d_mutex_unlock();
 
-            if (parentDevice) IDirect3DDevice8_Release(parentDevice);
+            if (parent_device)
+                IDirect3DDevice8_Release(parent_device);
         }
 
         return ref;
     }
 }
 
-/* IDirect3DSurface8 IDirect3DResource8 Interface follow: */
-static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface,
-        IDirect3DDevice8 **device)
+static HRESULT WINAPI d3d8_surface_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
 
     TRACE("iface %p, device %p.\n", iface, device);
 
-    if (This->forwardReference)
+    if (surface->forwardReference)
     {
         IDirect3DResource8 *resource;
         HRESULT hr;
 
-        hr = IUnknown_QueryInterface(This->forwardReference, &IID_IDirect3DResource8, (void **)&resource);
+        hr = IUnknown_QueryInterface(surface->forwardReference, &IID_IDirect3DResource8, (void **)&resource);
         if (SUCCEEDED(hr))
         {
             hr = IDirect3DResource8_GetDevice(resource, device);
@@ -133,7 +138,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface,
         return hr;
     }
 
-    *device = This->parentDevice;
+    *device = surface->parent_device;
     IDirect3DDevice8_AddRef(*device);
 
     TRACE("Returning device %p.\n", *device);
@@ -141,10 +146,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface,
     return D3D_OK;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(IDirect3DSurface8 *iface, REFGUID guid,
+static HRESULT WINAPI d3d8_surface_SetPrivateData(IDirect3DSurface8 *iface, REFGUID guid,
         const void *data, DWORD data_size, DWORD flags)
 {
-    IDirect3DSurface8Impl *surface = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     struct wined3d_resource *resource;
     HRESULT hr;
 
@@ -159,10 +164,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(IDirect3DSurface8 *if
     return hr;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid,
+static HRESULT WINAPI d3d8_surface_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid,
         void *data, DWORD *data_size)
 {
-    IDirect3DSurface8Impl *surface = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     struct wined3d_resource *resource;
     HRESULT hr;
 
@@ -177,9 +182,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(IDirect3DSurface8 *if
     return hr;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid)
+static HRESULT WINAPI d3d8_surface_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid)
 {
-    IDirect3DSurface8Impl *surface = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     struct wined3d_resource *resource;
     HRESULT hr;
 
@@ -193,33 +198,33 @@ static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(IDirect3DSurface8 *i
     return hr;
 }
 
-/* IDirect3DSurface8 Interface follow: */
-static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(IDirect3DSurface8 *iface, REFIID riid,
-        void **ppContainer)
+static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID riid, void **container)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
-    HRESULT res;
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
+    HRESULT hr;
 
-    TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer);
+    TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), container);
 
-    if (!This->container) return E_NOINTERFACE;
+    if (!surface->container)
+        return E_NOINTERFACE;
 
-    res = IUnknown_QueryInterface(This->container, riid, ppContainer);
+    hr = IUnknown_QueryInterface(surface->container, riid, container);
 
-    TRACE("(%p) : returning %p\n", This, *ppContainer);
-    return res;
+    TRACE("Returning %p.\n", *container);
+
+    return hr;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
+static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     struct wined3d_resource_desc wined3d_desc;
     struct wined3d_resource *wined3d_resource;
 
     TRACE("iface %p, desc %p.\n", iface, desc);
 
     wined3d_mutex_lock();
-    wined3d_resource = wined3d_surface_get_resource(This->wined3d_surface);
+    wined3d_resource = wined3d_surface_get_resource(surface->wined3d_surface);
     wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
     wined3d_mutex_unlock();
 
@@ -235,10 +240,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3
     return D3D_OK;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(IDirect3DSurface8 *iface,
+static HRESULT WINAPI d3d8_surface_LockRect(IDirect3DSurface8 *iface,
         D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     struct wined3d_map_desc map_desc;
     HRESULT hr;
 
@@ -265,7 +270,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(IDirect3DSurface8 *iface,
         }
     }
 
-    hr = wined3d_surface_map(This->wined3d_surface, &map_desc, rect, flags);
+    hr = wined3d_surface_map(surface->wined3d_surface, &map_desc, rect, flags);
     wined3d_mutex_unlock();
 
     locked_rect->Pitch = map_desc.row_pitch;
@@ -274,15 +279,15 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(IDirect3DSurface8 *iface,
     return hr;
 }
 
-static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(IDirect3DSurface8 *iface)
+static HRESULT WINAPI d3d8_surface_UnlockRect(IDirect3DSurface8 *iface)
 {
-    IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface);
+    struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
     HRESULT hr;
 
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    hr = wined3d_surface_unmap(This->wined3d_surface);
+    hr = wined3d_surface_unmap(surface->wined3d_surface);
     wined3d_mutex_unlock();
 
     switch(hr)
@@ -292,22 +297,22 @@ static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(IDirect3DSurface8 *iface)
     }
 }
 
-static const IDirect3DSurface8Vtbl Direct3DSurface8_Vtbl =
+static const IDirect3DSurface8Vtbl d3d8_surface_vtbl =
 {
     /* IUnknown */
-    IDirect3DSurface8Impl_QueryInterface,
-    IDirect3DSurface8Impl_AddRef,
-    IDirect3DSurface8Impl_Release,
+    d3d8_surface_QueryInterface,
+    d3d8_surface_AddRef,
+    d3d8_surface_Release,
     /* IDirect3DResource8 */
-    IDirect3DSurface8Impl_GetDevice,
-    IDirect3DSurface8Impl_SetPrivateData,
-    IDirect3DSurface8Impl_GetPrivateData,
-    IDirect3DSurface8Impl_FreePrivateData,
+    d3d8_surface_GetDevice,
+    d3d8_surface_SetPrivateData,
+    d3d8_surface_GetPrivateData,
+    d3d8_surface_FreePrivateData,
     /* IDirect3DSurface8 */
-    IDirect3DSurface8Impl_GetContainer,
-    IDirect3DSurface8Impl_GetDesc,
-    IDirect3DSurface8Impl_LockRect,
-    IDirect3DSurface8Impl_UnlockRect
+    d3d8_surface_GetContainer,
+    d3d8_surface_GetDesc,
+    d3d8_surface_LockRect,
+    d3d8_surface_UnlockRect,
 };
 
 static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
@@ -320,15 +325,15 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops =
     surface_wined3d_object_destroyed,
 };
 
-HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
+HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device,
         UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
         DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
 {
     DWORD flags = 0;
     HRESULT hr;
 
-    surface->IDirect3DSurface8_iface.lpVtbl = &Direct3DSurface8_Vtbl;
-    surface->ref = 1;
+    surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl;
+    surface->refcount = 1;
 
     /* FIXME: Check MAX bounds of MultisampleQuality. */
     if (multisample_quality > 0)
@@ -353,17 +358,17 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
         return hr;
     }
 
-    surface->parentDevice = &device->IDirect3DDevice8_iface;
-    IUnknown_AddRef(surface->parentDevice);
+    surface->parent_device = &device->IDirect3DDevice8_iface;
+    IUnknown_AddRef(surface->parent_device);
 
     return D3D_OK;
 }
 
-IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
+struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
 {
     if (!iface)
         return NULL;
-    assert(iface->lpVtbl == &Direct3DSurface8_Vtbl);
+    assert(iface->lpVtbl == &d3d8_surface_vtbl);
 
     return impl_from_IDirect3DSurface8(iface);
 }
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c
index 68706f3..44719d5 100644
--- a/dlls/d3d8/swapchain.c
+++ b/dlls/d3d8/swapchain.c
@@ -109,7 +109,7 @@ static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface,
 {
     struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface);
     struct wined3d_surface *wined3d_surface = NULL;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 49605d2..032a13b 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -284,7 +284,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetSurfaceLevel(IDirect3DTexture8 *iface,
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
 
     TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
 
@@ -308,7 +308,7 @@ static HRESULT WINAPI d3d8_texture_2d_LockRect(IDirect3DTexture8 *iface, UINT le
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n",
@@ -331,7 +331,7 @@ static HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     HRESULT hr;
 
     TRACE("iface %p, level %u.\n", iface, level);
@@ -654,7 +654,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture8
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     UINT sub_resource_idx;
 
     TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
@@ -681,7 +681,7 @@ static HRESULT WINAPI d3d8_texture_cube_LockRect(IDirect3DCubeTexture8 *iface,
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     UINT sub_resource_idx;
     HRESULT hr;
 
@@ -707,7 +707,7 @@ static HRESULT WINAPI d3d8_texture_cube_UnlockRect(IDirect3DCubeTexture8 *iface,
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
     struct wined3d_resource *sub_resource;
-    IDirect3DSurface8Impl *surface_impl;
+    struct d3d8_surface *surface_impl;
     UINT sub_resource_idx;
     HRESULT hr;
 
-- 
1.7.3.4




More information about the wine-patches mailing list