2 * Copyright 2010 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"
21 #include "d3dx9_36_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
25 static const struct ID3DXLineVtbl ID3DXLine_Vtbl;
27 typedef struct ID3DXLineImpl {
28 ID3DXLine ID3DXLine_iface;
31 IDirect3DDevice9 *device;
34 static inline ID3DXLineImpl *impl_from_ID3DXLine(ID3DXLine *iface)
36 return CONTAINING_RECORD(iface, ID3DXLineImpl, ID3DXLine_iface);
39 /*** IUnknown methods ***/
40 static HRESULT WINAPI ID3DXLineImpl_QueryInterface(ID3DXLine* iface, REFIID riid, LPVOID* object)
42 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
44 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
46 if (IsEqualGUID(riid, &IID_IUnknown) ||
47 IsEqualGUID(riid, &IID_ID3DXLine))
49 ID3DXLine_AddRef(iface);
54 ERR("Interface %s not found\n", debugstr_guid(riid));
59 static ULONG WINAPI ID3DXLineImpl_AddRef(ID3DXLine* iface)
61 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
63 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
65 return InterlockedIncrement(&This->ref);
68 static ULONG WINAPI ID3DXLineImpl_Release(ID3DXLine* iface)
70 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
71 ULONG ref = InterlockedDecrement(&This->ref);
73 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
77 IDirect3DDevice9_Release(This->device);
78 HeapFree(GetProcessHeap(), 0, This);
84 /*** ID3DXLine methods ***/
85 static HRESULT WINAPI ID3DXLineImpl_GetDevice(ID3DXLine* iface, LPDIRECT3DDEVICE9* device)
87 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
89 TRACE ("(%p)->(%p): relay\n", This, device);
91 if (device == NULL) return D3DERR_INVALIDCALL;
93 *device = This->device;
94 IDirect3DDevice9_AddRef(This->device);
99 static HRESULT WINAPI ID3DXLineImpl_Begin(ID3DXLine* iface)
101 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
103 FIXME("(%p)->(): stub\n", This);
108 static HRESULT WINAPI ID3DXLineImpl_Draw(ID3DXLine* iface, CONST D3DXVECTOR2* vertexlist, DWORD vertexlistcount, D3DCOLOR color)
110 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
112 FIXME("(%p)->(%p, %u, %#x): stub\n", This, vertexlist, vertexlistcount, color);
117 static HRESULT WINAPI ID3DXLineImpl_DrawTransform(ID3DXLine* iface, CONST D3DXVECTOR3* vertexlist, DWORD vertexlistcount,
118 CONST D3DXMATRIX* transform, D3DCOLOR color)
120 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
122 FIXME("(%p)->(%p, %u, %p, %#x): stub\n", This, vertexlist, vertexlistcount, transform, color);
127 static HRESULT WINAPI ID3DXLineImpl_SetPattern(ID3DXLine* iface, DWORD pattern)
129 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
131 FIXME("(%p)->(%#x): stub\n", This, pattern);
136 static DWORD WINAPI ID3DXLineImpl_GetPattern(ID3DXLine* iface)
138 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
140 FIXME("(%p)->(): stub\n", This);
145 static HRESULT WINAPI ID3DXLineImpl_SetPatternScale(ID3DXLine* iface, FLOAT scale)
147 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
149 FIXME("(%p)->(%f): stub\n", This, scale);
154 static FLOAT WINAPI ID3DXLineImpl_GetPatternScale(ID3DXLine* iface)
156 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
158 FIXME("(%p)->(): stub\n", This);
163 static HRESULT WINAPI ID3DXLineImpl_SetWidth(ID3DXLine* iface, FLOAT width)
165 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
167 FIXME("(%p)->(%f): stub\n", This, width);
172 static FLOAT WINAPI ID3DXLineImpl_GetWidth(ID3DXLine* iface)
174 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
176 FIXME("(%p)->(): stub\n", This);
181 static HRESULT WINAPI ID3DXLineImpl_SetAntialias(ID3DXLine* iface, BOOL antialias)
183 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
185 FIXME("(%p)->(%u): stub\n", This, antialias);
190 static BOOL WINAPI ID3DXLineImpl_GetAntialias(ID3DXLine* iface)
192 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
194 FIXME("(%p)->(): stub\n", This);
199 static HRESULT WINAPI ID3DXLineImpl_SetGLLines(ID3DXLine* iface, BOOL gl_lines)
201 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
203 FIXME("(%p)->(%u): stub\n", This, gl_lines);
208 static BOOL WINAPI ID3DXLineImpl_GetGLLines(ID3DXLine* iface)
210 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
212 FIXME("(%p)->(): stub\n", This);
217 static HRESULT WINAPI ID3DXLineImpl_End(ID3DXLine* iface)
219 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
221 FIXME("(%p)->(): stub\n", This);
226 static HRESULT WINAPI ID3DXLineImpl_OnLostDevice(ID3DXLine* iface)
228 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
230 FIXME("(%p)->(): stub\n", This);
234 static HRESULT WINAPI ID3DXLineImpl_OnResetDevice(ID3DXLine* iface)
236 ID3DXLineImpl *This = impl_from_ID3DXLine(iface);
238 FIXME("(%p)->(): stub\n", This);
243 static const struct ID3DXLineVtbl ID3DXLine_Vtbl =
245 /*** IUnknown methods ***/
246 ID3DXLineImpl_QueryInterface,
247 ID3DXLineImpl_AddRef,
248 ID3DXLineImpl_Release,
249 /*** ID3DXLine methods ***/
250 ID3DXLineImpl_GetDevice,
253 ID3DXLineImpl_DrawTransform,
254 ID3DXLineImpl_SetPattern,
255 ID3DXLineImpl_GetPattern,
256 ID3DXLineImpl_SetPatternScale,
257 ID3DXLineImpl_GetPatternScale,
258 ID3DXLineImpl_SetWidth,
259 ID3DXLineImpl_GetWidth,
260 ID3DXLineImpl_SetAntialias,
261 ID3DXLineImpl_GetAntialias,
262 ID3DXLineImpl_SetGLLines,
263 ID3DXLineImpl_GetGLLines,
265 ID3DXLineImpl_OnLostDevice,
266 ID3DXLineImpl_OnResetDevice
269 HRESULT WINAPI D3DXCreateLine(LPDIRECT3DDEVICE9 device, LPD3DXLINE* line)
271 ID3DXLineImpl* object;
273 TRACE("(%p, %p)\n", device, line);
275 if (!device || !line)
276 return D3DERR_INVALIDCALL;
278 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXLineImpl));
281 ERR("Out of memory\n");
282 return E_OUTOFMEMORY;
285 object->ID3DXLine_iface.lpVtbl = &ID3DXLine_Vtbl;
287 object->device = device;
288 IDirect3DDevice9_AddRef(device);
290 *line = &object->ID3DXLine_iface;