2 * Copyright (C) 2008 Tony Wasserka
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 HRESULT WINAPI
ID3DXSpriteImpl_QueryInterface(LPD3DXSPRITE iface
, REFIID riid
, LPVOID
*object
)
27 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
29 TRACE("(%p): QueryInterface from %s\n", This
, debugstr_guid(riid
));
30 if(IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_ID3DXSprite
)) {
31 IUnknown_AddRef(iface
);
35 WARN("(%p)->(%s, %p): not found\n", iface
, debugstr_guid(riid
), *object
);
39 static ULONG WINAPI
ID3DXSpriteImpl_AddRef(LPD3DXSPRITE iface
)
41 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
42 ULONG ref
=InterlockedIncrement(&This
->ref
);
43 TRACE("(%p): AddRef from %d\n", This
, ref
-1);
47 static ULONG WINAPI
ID3DXSpriteImpl_Release(LPD3DXSPRITE iface
)
49 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
50 ULONG ref
=InterlockedDecrement(&This
->ref
);
51 TRACE("(%p): ReleaseRef to %d\n", This
, ref
);
54 HeapFree(GetProcessHeap(), 0, This
);
59 static HRESULT WINAPI
ID3DXSpriteImpl_GetDevice(LPD3DXSPRITE iface
, LPDIRECT3DDEVICE9
*device
)
61 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
62 FIXME("(%p): stub\n", This
);
66 static HRESULT WINAPI
ID3DXSpriteImpl_GetTransform(LPD3DXSPRITE iface
, D3DXMATRIX
*transform
)
68 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
69 FIXME("(%p): stub\n", This
);
73 static HRESULT WINAPI
ID3DXSpriteImpl_SetTransform(LPD3DXSPRITE iface
, CONST D3DXMATRIX
*transform
)
75 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
76 FIXME("(%p): stub\n", This
);
80 static HRESULT WINAPI
ID3DXSpriteImpl_SetWorldViewRH(LPD3DXSPRITE iface
, CONST D3DXMATRIX
*world
, CONST D3DXMATRIX
*view
)
82 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
83 FIXME("(%p): stub\n", This
);
87 static HRESULT WINAPI
ID3DXSpriteImpl_SetWorldViewLH(LPD3DXSPRITE iface
, CONST D3DXMATRIX
*world
, CONST D3DXMATRIX
*view
)
89 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
90 FIXME("(%p): stub\n", This
);
94 static HRESULT WINAPI
ID3DXSpriteImpl_Begin(LPD3DXSPRITE iface
, DWORD flags
)
96 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
97 FIXME("(%p): stub\n", This
);
101 static HRESULT WINAPI
ID3DXSpriteImpl_Draw(LPD3DXSPRITE iface
, LPDIRECT3DTEXTURE9 texture
, CONST RECT
*rect
, CONST D3DXVECTOR3
*center
,
102 CONST D3DXVECTOR3
*position
, D3DCOLOR color
)
104 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
105 FIXME("(%p): stub\n", This
);
109 static HRESULT WINAPI
ID3DXSpriteImpl_Flush(LPD3DXSPRITE iface
)
111 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
112 FIXME("(%p): stub\n", This
);
116 static HRESULT WINAPI
ID3DXSpriteImpl_End(LPD3DXSPRITE iface
)
118 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
119 FIXME("(%p): stub\n", This
);
123 static HRESULT WINAPI
ID3DXSpriteImpl_OnLostDevice(LPD3DXSPRITE iface
)
125 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
126 FIXME("(%p): stub\n", This
);
130 static HRESULT WINAPI
ID3DXSpriteImpl_OnResetDevice(LPD3DXSPRITE iface
)
132 ID3DXSpriteImpl
*This
=(ID3DXSpriteImpl
*)iface
;
133 FIXME("(%p): stub\n", This
);
137 static const ID3DXSpriteVtbl D3DXSprite_Vtbl
=
139 /*** IUnknown methods ***/
140 ID3DXSpriteImpl_QueryInterface
,
141 ID3DXSpriteImpl_AddRef
,
142 ID3DXSpriteImpl_Release
,
143 /*** ID3DXSprite methods ***/
144 ID3DXSpriteImpl_GetDevice
,
145 ID3DXSpriteImpl_GetTransform
,
146 ID3DXSpriteImpl_SetTransform
,
147 ID3DXSpriteImpl_SetWorldViewRH
,
148 ID3DXSpriteImpl_SetWorldViewLH
,
149 ID3DXSpriteImpl_Begin
,
150 ID3DXSpriteImpl_Draw
,
151 ID3DXSpriteImpl_Flush
,
153 ID3DXSpriteImpl_OnLostDevice
,
154 ID3DXSpriteImpl_OnResetDevice
157 HRESULT WINAPI
D3DXCreateSprite(LPDIRECT3DDEVICE9 device
, LPD3DXSPRITE
*sprite
)
159 ID3DXSpriteImpl
*object
;
163 if(device
==NULL
|| sprite
==NULL
) return D3DERR_INVALIDCALL
;
165 object
=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(ID3DXSpriteImpl
));
168 return E_OUTOFMEMORY
;
170 object
->lpVtbl
=&D3DXSprite_Vtbl
;
173 *sprite
=(ID3DXSprite
*)object
;