[PATCH 1/7] d3drm: Use CreateObject in IDirect3DRM*::LoadTexture. (v3)

Aaryaman Vasishta jem456.vasishta at gmail.com
Thu May 19 06:00:48 CDT 2016


Signed-off-by: Aaryaman Vasishta <jem456.vasishta at gmail.com>
---
 dlls/d3drm/d3drm.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/d3drm/d3drm.c b/dlls/d3drm/d3drm.c
index edb46df..5cccf17 100644
--- a/dlls/d3drm/d3drm.c
+++ b/dlls/d3drm/d3drm.c
@@ -413,16 +413,14 @@ static HRESULT WINAPI d3drm1_CreateUserVisual(IDirect3DRM *iface,
 static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface,
         const char *filename, IDirect3DRMTexture **texture)
 {
-    struct d3drm_texture *object;
     HRESULT hr;
 
     FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
 
-    if (FAILED(hr = d3drm_texture_create(&object)))
+    if (FAILED(hr = IDirect3DRM_CreateObject(iface, &CLSID_CDirect3DRMTexture, NULL,
+            &IID_IDirect3DRMTexture, (void **)texture)))
         return hr;
 
-    *texture = &object->IDirect3DRMTexture_iface;
-
     return D3DRM_OK;
 }
 
@@ -857,17 +855,19 @@ static HRESULT WINAPI d3drm2_CreateUserVisual(IDirect3DRM2 *iface,
 static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface,
         const char *filename, IDirect3DRMTexture2 **texture)
 {
-    struct d3drm_texture *object;
+    struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
+    IDirect3DRMTexture3 *texture3;
     HRESULT hr;
 
     FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
 
-    if (FAILED(hr = d3drm_texture_create(&object)))
+    if (FAILED(hr = IDirect3DRM3_LoadTexture(&d3drm->IDirect3DRM3_iface, filename, &texture3)))
         return hr;
 
-    *texture = &object->IDirect3DRMTexture2_iface;
+    hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture);
+    IDirect3DRMTexture3_Release(texture3);
 
-    return D3DRM_OK;
+    return hr;
 }
 
 static HRESULT WINAPI d3drm2_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module,
@@ -1396,16 +1396,14 @@ static HRESULT WINAPI d3drm3_CreateUserVisual(IDirect3DRM3 *iface,
 static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface,
         const char *filename, IDirect3DRMTexture3 **texture)
 {
-    struct d3drm_texture *object;
     HRESULT hr;
 
     FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
 
-    if (FAILED(hr = d3drm_texture_create(&object)))
+    if (FAILED(hr = IDirect3DRM3_CreateObject(iface, &CLSID_CDirect3DRMTexture, NULL,
+            &IID_IDirect3DRMTexture3, (void **)texture)))
         return hr;
 
-    *texture = &object->IDirect3DRMTexture3_iface;
-
     return D3DRM_OK;
 }
 
-- 
2.3.2 (Apple Git-55)




More information about the wine-patches mailing list