2 * Copyright (C) 2012 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
28 ID3DXFile ID3DXFile_iface;
33 static inline ID3DXFileImpl* impl_from_ID3DXFile(ID3DXFile *iface)
35 return CONTAINING_RECORD(iface, ID3DXFileImpl, ID3DXFile_iface);
39 /*** IUnknown methods ***/
41 static HRESULT WINAPI ID3DXFileImpl_QueryInterface(ID3DXFile *iface, REFIID riid, void **ret_iface)
43 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
45 if (IsEqualGUID(riid, &IID_IUnknown) ||
46 IsEqualGUID(riid, &IID_ID3DXFile))
48 iface->lpVtbl->AddRef(iface);
53 WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface);
59 static ULONG WINAPI ID3DXFileImpl_AddRef(ID3DXFile *iface)
61 ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
62 ULONG ref = InterlockedIncrement(&This->ref);
64 TRACE("(%p)->(): new ref %d\n", iface, ref);
70 static ULONG WINAPI ID3DXFileImpl_Release(ID3DXFile *iface)
72 ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
73 ULONG ref = InterlockedDecrement(&This->ref);
75 TRACE("(%p)->(): new ref %d\n", iface, ref);
78 HeapFree(GetProcessHeap(), 0, This);
84 /*** ID3DXFile methods ***/
86 static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const void *source, D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
88 FIXME("(%p)->(%p, %x, %p): stub\n", iface, source, options, enum_object);
94 static HRESULT WINAPI ID3DXFileImpl_CreateSaveObject(ID3DXFile *iface, const void *data, D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object)
96 FIXME("(%p)->(%p, %x, %u, %p): stub\n", iface, data, options, format, save_object);
102 static HRESULT WINAPI ID3DXFileImpl_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size)
104 FIXME("(%p)->(%p, %lu): stub\n", iface, data, size);
110 static HRESULT WINAPI ID3DXFileImpl_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object)
112 FIXME("(%p)->(%p): stub\n", iface, enum_object);
118 static const ID3DXFileVtbl ID3DXFile_Vtbl =
120 ID3DXFileImpl_QueryInterface,
121 ID3DXFileImpl_AddRef,
122 ID3DXFileImpl_Release,
123 ID3DXFileImpl_CreateEnumObject,
124 ID3DXFileImpl_CreateSaveObject,
125 ID3DXFileImpl_RegisterTemplates,
126 ID3DXFileImpl_RegisterEnumTemplates
129 HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
131 ID3DXFileImpl *object;
133 TRACE("(%p)\n", d3dxfile);
140 object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
142 return E_OUTOFMEMORY;
144 object->ID3DXFile_iface.lpVtbl = &ID3DXFile_Vtbl;
147 *d3dxfile = &object->ID3DXFile_iface;