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
;
32 static inline ID3DXLineImpl
*impl_from_ID3DXLine(ID3DXLine
*iface
)
34 return CONTAINING_RECORD(iface
, ID3DXLineImpl
, ID3DXLine_iface
);
37 /*** IUnknown methods ***/
38 static HRESULT WINAPI
ID3DXLineImpl_QueryInterface(ID3DXLine
* iface
, REFIID riid
, LPVOID
* object
)
40 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
42 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), object
);
44 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
45 IsEqualGUID(riid
, &IID_ID3DXLine
))
47 ID3DXLine_AddRef(iface
);
52 ERR("Interface %s not found\n", debugstr_guid(riid
));
57 static ULONG WINAPI
ID3DXLineImpl_AddRef(ID3DXLine
* iface
)
59 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
61 TRACE("(%p)->(): AddRef from %u\n", This
, This
->ref
);
63 return InterlockedIncrement(&This
->ref
);
66 static ULONG WINAPI
ID3DXLineImpl_Release(ID3DXLine
* iface
)
68 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
69 ULONG ref
= InterlockedDecrement(&This
->ref
);
71 TRACE("(%p)->(): Release from %u\n", This
, ref
+ 1);
74 HeapFree(GetProcessHeap(), 0, This
);
79 /*** ID3DXLine methods ***/
80 static HRESULT WINAPI
ID3DXLineImpl_GetDevice(ID3DXLine
* iface
, LPDIRECT3DDEVICE9
* device
)
82 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
84 FIXME("(%p)->(%p): stub\n", This
, device
);
89 static HRESULT WINAPI
ID3DXLineImpl_Begin(ID3DXLine
* iface
)
91 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
93 FIXME("(%p)->(): stub\n", This
);
98 static HRESULT WINAPI
ID3DXLineImpl_Draw(ID3DXLine
* iface
, CONST D3DXVECTOR2
* vertexlist
, DWORD vertexlistcount
, D3DCOLOR color
)
100 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
102 FIXME("(%p)->(%p, %u, %#x): stub\n", This
, vertexlist
, vertexlistcount
, color
);
107 static HRESULT WINAPI
ID3DXLineImpl_DrawTransform(ID3DXLine
* iface
, CONST D3DXVECTOR3
* vertexlist
, DWORD vertexlistcount
,
108 CONST D3DXMATRIX
* transform
, D3DCOLOR color
)
110 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
112 FIXME("(%p)->(%p, %u, %p, %#x): stub\n", This
, vertexlist
, vertexlistcount
, transform
, color
);
117 static HRESULT WINAPI
ID3DXLineImpl_SetPattern(ID3DXLine
* iface
, DWORD pattern
)
119 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
121 FIXME("(%p)->(%#x): stub\n", This
, pattern
);
126 static DWORD WINAPI
ID3DXLineImpl_GetPattern(ID3DXLine
* iface
)
128 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
130 FIXME("(%p)->(): stub\n", This
);
135 static HRESULT WINAPI
ID3DXLineImpl_SetPatternScale(ID3DXLine
* iface
, FLOAT scale
)
137 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
139 FIXME("(%p)->(%f): stub\n", This
, scale
);
144 static FLOAT WINAPI
ID3DXLineImpl_GetPatternScale(ID3DXLine
* iface
)
146 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
148 FIXME("(%p)->(): stub\n", This
);
153 static HRESULT WINAPI
ID3DXLineImpl_SetWidth(ID3DXLine
* iface
, FLOAT width
)
155 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
157 FIXME("(%p)->(%f): stub\n", This
, width
);
162 static FLOAT WINAPI
ID3DXLineImpl_GetWidth(ID3DXLine
* iface
)
164 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
166 FIXME("(%p)->(): stub\n", This
);
171 static HRESULT WINAPI
ID3DXLineImpl_SetAntialias(ID3DXLine
* iface
, BOOL antialias
)
173 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
175 FIXME("(%p)->(%u): stub\n", This
, antialias
);
180 static BOOL WINAPI
ID3DXLineImpl_GetAntialias(ID3DXLine
* iface
)
182 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
184 FIXME("(%p)->(): stub\n", This
);
189 static HRESULT WINAPI
ID3DXLineImpl_SetGLLines(ID3DXLine
* iface
, BOOL gl_lines
)
191 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
193 FIXME("(%p)->(%u): stub\n", This
, gl_lines
);
198 static BOOL WINAPI
ID3DXLineImpl_GetGLLines(ID3DXLine
* iface
)
200 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
202 FIXME("(%p)->(): stub\n", This
);
207 static HRESULT WINAPI
ID3DXLineImpl_End(ID3DXLine
* iface
)
209 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
211 FIXME("(%p)->(): stub\n", This
);
216 static HRESULT WINAPI
ID3DXLineImpl_OnLostDevice(ID3DXLine
* iface
)
218 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
220 FIXME("(%p)->(): stub\n", This
);
224 static HRESULT WINAPI
ID3DXLineImpl_OnResetDevice(ID3DXLine
* iface
)
226 ID3DXLineImpl
*This
= impl_from_ID3DXLine(iface
);
228 FIXME("(%p)->(): stub\n", This
);
233 static const struct ID3DXLineVtbl ID3DXLine_Vtbl
=
235 /*** IUnknown methods ***/
236 ID3DXLineImpl_QueryInterface
,
237 ID3DXLineImpl_AddRef
,
238 ID3DXLineImpl_Release
,
239 /*** ID3DXLine methods ***/
240 ID3DXLineImpl_GetDevice
,
243 ID3DXLineImpl_DrawTransform
,
244 ID3DXLineImpl_SetPattern
,
245 ID3DXLineImpl_GetPattern
,
246 ID3DXLineImpl_SetPatternScale
,
247 ID3DXLineImpl_GetPatternScale
,
248 ID3DXLineImpl_SetWidth
,
249 ID3DXLineImpl_GetWidth
,
250 ID3DXLineImpl_SetAntialias
,
251 ID3DXLineImpl_GetAntialias
,
252 ID3DXLineImpl_SetGLLines
,
253 ID3DXLineImpl_GetGLLines
,
255 ID3DXLineImpl_OnLostDevice
,
256 ID3DXLineImpl_OnResetDevice
259 HRESULT WINAPI
D3DXCreateLine(LPDIRECT3DDEVICE9 device
, LPD3DXLINE
* line
)
261 ID3DXLineImpl
* object
;
263 TRACE("(%p, %p)\n", device
, line
);
265 if (!device
|| !line
)
266 return D3DERR_INVALIDCALL
;
268 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(ID3DXLineImpl
));
271 ERR("Out of memory\n");
272 return E_OUTOFMEMORY
;
275 object
->ID3DXLine_iface
.lpVtbl
= &ID3DXLine_Vtbl
;
278 *line
= &object
->ID3DXLine_iface
;