Henri Verbeet : wined3d: Pass an IWineD3DResourceImpl pointer to resource_init().

Alexandre Julliard julliard at winehq.org
Thu Jan 6 12:33:51 CST 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jan  6 09:38:59 2011 +0100

wined3d: Pass an IWineD3DResourceImpl pointer to resource_init().

---

 dlls/wined3d/basetexture.c     |    2 +-
 dlls/wined3d/buffer.c          |    2 +-
 dlls/wined3d/resource.c        |   38 +++++++++++++++++++-------------------
 dlls/wined3d/surface.c         |    2 +-
 dlls/wined3d/volume.c          |    2 +-
 dlls/wined3d/wined3d_private.h |    2 +-
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 26beb29..d6678b7 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -34,7 +34,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
 {
     HRESULT hr;
 
-    hr = resource_init((IWineD3DResource *)texture, resource_type, device,
+    hr = resource_init((IWineD3DResourceImpl *)texture, resource_type, device,
             0, usage, format, pool, parent, parent_ops);
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 3048834..bfed37c 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1473,7 +1473,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
 
     buffer->vtbl = &wined3d_buffer_vtbl;
 
-    hr = resource_init((IWineD3DResource *)buffer, WINED3DRTYPE_BUFFER,
+    hr = resource_init((IWineD3DResourceImpl *)buffer, WINED3DRTYPE_BUFFER,
             device, size, usage, format, pool, parent, parent_ops);
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index b8b8594..0c8aa98 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -43,28 +43,28 @@ struct private_data
     DWORD size;
 };
 
-HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
+HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE resource_type,
         IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
         WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
 {
-    struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
-
-    resource->device = device;
-    resource->resourceType = resource_type;
-    resource->ref = 1;
-    resource->pool = pool;
-    resource->format = format;
-    resource->usage = usage;
-    resource->size = size;
-    resource->priority = 0;
-    resource->parent = parent;
-    resource->parent_ops = parent_ops;
-    list_init(&resource->privateData);
+    struct IWineD3DResourceClass *r = &resource->resource;
+
+    r->device = device;
+    r->resourceType = resource_type;
+    r->ref = 1;
+    r->pool = pool;
+    r->format = format;
+    r->usage = usage;
+    r->size = size;
+    r->priority = 0;
+    r->parent = parent;
+    r->parent_ops = parent_ops;
+    list_init(&r->privateData);
 
     if (size)
     {
-        resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
-        if (!resource->heapMemory)
+        r->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT);
+        if (!r->heapMemory)
         {
             ERR("Out of memory!\n");
             return WINED3DERR_OUTOFVIDEOMEMORY;
@@ -72,9 +72,9 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
     }
     else
     {
-        resource->heapMemory = NULL;
+        r->heapMemory = NULL;
     }
-    resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
+    r->allocatedMemory = (BYTE *)(((ULONG_PTR)r->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
 
     /* Check that we have enough video ram left */
     if (pool == WINED3DPOOL_DEFAULT)
@@ -82,13 +82,13 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
         if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device))
         {
             ERR("Out of adapter memory\n");
-            HeapFree(GetProcessHeap(), 0, resource->heapMemory);
+            HeapFree(GetProcessHeap(), 0, r->heapMemory);
             return WINED3DERR_OUTOFVIDEOMEMORY;
         }
         WineD3DAdapterChangeGLRam(device, size);
     }
 
-    device_resource_add(device, iface);
+    device_resource_add(device, (IWineD3DResource *)resource);
 
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 29d98ee..a4f37cc 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -373,7 +373,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
             return WINED3DERR_INVALIDCALL;
     }
 
-    hr = resource_init((IWineD3DResource *)surface, WINED3DRTYPE_SURFACE,
+    hr = resource_init((IWineD3DResourceImpl *)surface, WINED3DRTYPE_SURFACE,
             device, resource_size, usage, format, pool, parent, parent_ops);
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 48e2c7b..8ccc482 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -346,7 +346,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
 
     volume->lpVtbl = &IWineD3DVolume_Vtbl;
 
-    hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device,
+    hr = resource_init((IWineD3DResourceImpl *)volume, WINED3DRTYPE_VOLUME, device,
             width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops);
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7562101..9d4009c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1833,7 +1833,7 @@ HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSP
 DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
 HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
         void *data, DWORD *data_size) DECLSPEC_HIDDEN;
-HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
+HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE resource_type,
         IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
         WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
 WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list