VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/stateblock.c@ 16477

Last change on this file since 16477 was 16477, checked in by vboxsync, 16 years ago

LGPL disclaimer by filemuncher

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
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/*
24 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
25 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
26 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
27 * a choice of LGPL license versions is made available with the language indicating
28 * that LGPLv2 or any later version may be used, or where a choice of which version
29 * of the LGPL is applied is otherwise unspecified.
30 */
31
32#include "config.h"
33#include "d3d8_private.h"
34
35WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
36
37/* NOTE: DirectX8 doesn't export an IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as similar as possible */
38/* IDirect3DStateBlock8 IUnknown parts follow: */
39static HRESULT WINAPI IDirect3DStateBlock8Impl_QueryInterface(IDirect3DStateBlock8 *iface, REFIID riid, LPVOID *ppobj) {
40 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
41
42 if (IsEqualGUID(riid, &IID_IUnknown)
43 || IsEqualGUID(riid, &IID_IDirect3DStateBlock8)) {
44 IUnknown_AddRef(iface);
45 *ppobj = This;
46 return S_OK;
47 }
48
49 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
50 *ppobj = NULL;
51 return E_NOINTERFACE;
52}
53
54static ULONG WINAPI IDirect3DStateBlock8Impl_AddRef(IDirect3DStateBlock8 *iface) {
55 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
56 ULONG ref = InterlockedIncrement(&This->ref);
57
58 TRACE("(%p) : AddRef from %d\n", This, ref - 1);
59
60 return ref;
61}
62
63static ULONG WINAPI IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8 *iface) {
64 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
65 ULONG ref = InterlockedDecrement(&This->ref);
66
67 TRACE("(%p) : ReleaseRef to %d\n", This, ref);
68
69 if (ref == 0) {
70 IWineD3DStateBlock_Release(This->wineD3DStateBlock);
71 HeapFree(GetProcessHeap(), 0, This);
72 }
73 return ref;
74}
75
76/* IDirect3DStateBlock8 Interface follow: */
77static HRESULT WINAPI IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8 *iface, IDirect3DDevice8 **ppDevice) {
78 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
79 TRACE("(%p) Relay\n", This);
80 return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
81}
82
83static HRESULT WINAPI IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8 *iface) {
84 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
85 TRACE("(%p) Relay\n", This);
86 return IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
87}
88
89static HRESULT WINAPI IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8 *iface) {
90 IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
91 TRACE("(%p) Relay\n", This);
92 return IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
93}
94
95const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl =
96{
97 /* IUnknown */
98 IDirect3DStateBlock8Impl_QueryInterface,
99 IDirect3DStateBlock8Impl_AddRef,
100 IDirect3DStateBlock8Impl_Release,
101 /* IDirect3DStateBlock8 */
102 IDirect3DStateBlock8Impl_GetDevice,
103 IDirect3DStateBlock8Impl_Capture,
104 IDirect3DStateBlock8Impl_Apply
105};
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette