Delete all Trailing spaces in code.
[reactos.git] / reactos / dll / directx / wine / d3d8 / stateblock.c
1 /*
2 * IDirect3DStateBlock8 implementation
3 *
4 * Copyright 2002-2003 Raphael Junqueira
5 * Copyright 2002-2003 Jason Edmeades
6 * Copyright 2005 Oliver Stieber
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #include "config.h"
24 #include "d3d8_private.h"
25
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
27
28 /* NOTE: DirectX8 doesn't export a IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as simila as possible */
29 /* IDirect3DStateBlock8 IUnknown parts follow: */
30 static HRESULT WINAPI IDirect3DStateBlock8Impl_QueryInterface(IDirect3DStateBlock8 *iface, REFIID riid, LPVOID *ppobj) {
31 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
32
33 if (IsEqualGUID(riid, &IID_IUnknown)
34 || IsEqualGUID(riid, &IID_IDirect3DStateBlock8)) {
35 IUnknown_AddRef(iface);
36 *ppobj = This;
37 return S_OK;
38 }
39
40 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
41 *ppobj = NULL;
42 return E_NOINTERFACE;
43 }
44
45 static ULONG WINAPI IDirect3DStateBlock8Impl_AddRef(IDirect3DStateBlock8 *iface) {
46 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
47 ULONG ref = InterlockedIncrement(&This->ref);
48
49 TRACE("(%p) : AddRef from %d\n", This, ref - 1);
50
51 return ref;
52 }
53
54 static ULONG WINAPI IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8 *iface) {
55 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
56 ULONG ref = InterlockedDecrement(&This->ref);
57
58 TRACE("(%p) : ReleaseRef to %d\n", This, ref);
59
60 if (ref == 0) {
61 IWineD3DStateBlock_Release(This->wineD3DStateBlock);
62 HeapFree(GetProcessHeap(), 0, This);
63 }
64 return ref;
65 }
66
67 /* IDirect3DStateBlock8 Interface follow: */
68 static HRESULT WINAPI IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8 *iface, IDirect3DDevice8 **ppDevice) {
69 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
70 TRACE("(%p) Relay\n", This);
71 return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
72 }
73
74 static HRESULT WINAPI IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8 *iface) {
75 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
76 TRACE("(%p) Relay\n", This);
77 return IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
78 }
79
80 static HRESULT WINAPI IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8 *iface) {
81 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
82 TRACE("(%p) Relay\n", This);
83 return IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
84 }
85
86 const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl =
87 {
88 /* IUnknown */
89 IDirect3DStateBlock8Impl_QueryInterface,
90 IDirect3DStateBlock8Impl_AddRef,
91 IDirect3DStateBlock8Impl_Release,
92 /* IDirect3DStateBlock8 */
93 IDirect3DStateBlock8Impl_GetDevice,
94 IDirect3DStateBlock8Impl_Capture,
95 IDirect3DStateBlock8Impl_Apply
96 };