Commit 78ea105b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d9: COM cleanup for the IDirect3DQuery9 iface.

parent 0f10e1b3
......@@ -465,15 +465,14 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader,
* IDirect3DPixelShader implementation structure
*/
typedef struct IDirect3DQuery9Impl {
/* IUnknown fields */
const IDirect3DQuery9Vtbl *lpVtbl;
IDirect3DQuery9 IDirect3DQuery9_iface;
LONG ref;
/* IDirect3DQuery9 fields */
struct wined3d_query *wineD3DQuery;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
IDirect3DDevice9Ex *parentDevice;
} IDirect3DQuery9Impl;
HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device,
......
......@@ -2706,8 +2706,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(IDirect3DDevice9Ex *iface
}
TRACE("Created query %p.\n", object);
if (query) *query = (IDirect3DQuery9 *)object;
else IDirect3DQuery9_Release((IDirect3DQuery9 *)object);
if (query) *query = &object->IDirect3DQuery9_iface;
else IDirect3DQuery9_Release(&object->IDirect3DQuery9_iface);
return D3D_OK;
}
......
......@@ -25,9 +25,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
/* IDirect3DQuery9 IUnknown parts follow: */
static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static inline IDirect3DQuery9Impl *impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DQuery9Impl, IDirect3DQuery9_iface);
}
static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(IDirect3DQuery9 *iface, REFIID riid,
void **ppobj)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
......@@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface,
return E_NOINTERFACE;
}
static ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static ULONG WINAPI IDirect3DQuery9Impl_AddRef(IDirect3DQuery9 *iface)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", iface, ref);
......@@ -52,8 +59,9 @@ static ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) {
return ref;
}
static ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static ULONG WINAPI IDirect3DQuery9Impl_Release(IDirect3DQuery9 *iface)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u.\n", iface, ref);
......@@ -69,10 +77,10 @@ static ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) {
return ref;
}
/* IDirect3DQuery9 Interface follow: */
static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, IDirect3DDevice9 **device)
static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface,
IDirect3DDevice9 **device)
{
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
TRACE("iface %p, device %p.\n", iface, device);
......@@ -84,8 +92,9 @@ static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, IDir
return D3D_OK;
}
static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(IDirect3DQuery9 *iface)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
......@@ -97,8 +106,9 @@ static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) {
return hr;
}
static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(IDirect3DQuery9 *iface)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
DWORD ret;
TRACE("iface %p.\n", iface);
......@@ -110,8 +120,9 @@ static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) {
return ret;
}
static HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static HRESULT WINAPI IDirect3DQuery9Impl_Issue(IDirect3DQuery9 *iface, DWORD dwIssueFlags)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
HRESULT hr;
TRACE("iface %p, flags %#x.\n", iface, dwIssueFlags);
......@@ -123,8 +134,10 @@ static HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dw
return hr;
}
static HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
static HRESULT WINAPI IDirect3DQuery9Impl_GetData(IDirect3DQuery9 *iface, void *pData,
DWORD dwSize, DWORD dwGetDataFlags)
{
IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface);
HRESULT hr;
TRACE("iface %p, data %p, size %u, flags %#x.\n",
......@@ -154,7 +167,7 @@ HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3D
{
HRESULT hr;
query->lpVtbl = &Direct3DQuery9_Vtbl;
query->IDirect3DQuery9_iface.lpVtbl = &Direct3DQuery9_Vtbl;
query->ref = 1;
wined3d_mutex_lock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment