VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/resource.c@ 19982

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

LGPL disclaimer by filemuncher

  • Property svn:eol-style set to native
File size: 5.5 KB
Line 
1/*
2 * IDirect3DResource8 implementation
3 *
4 * Copyright 2005 Oliver Stieber
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21/*
22 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
23 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
24 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
25 * a choice of LGPL license versions is made available with the language indicating
26 * that LGPLv2 or any later version may be used, or where a choice of which version
27 * of the LGPL is applied is otherwise unspecified.
28 */
29
30#include "config.h"
31#include "d3d8_private.h"
32
33WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
34
35/* IDirect3DResource8 IUnknown parts follow: */
36static HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface, REFIID riid, LPVOID* ppobj) {
37 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
38
39 if (IsEqualGUID(riid, &IID_IUnknown)
40 || IsEqualGUID(riid, &IID_IDirect3DResource8)) {
41 IUnknown_AddRef(iface);
42 *ppobj = This;
43 return S_OK;
44 }
45
46 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
47 *ppobj = NULL;
48 return E_NOINTERFACE;
49}
50
51static ULONG WINAPI IDirect3DResource8Impl_AddRef(LPDIRECT3DRESOURCE8 iface) {
52 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
53 ULONG ref = InterlockedIncrement(&This->ref);
54
55 TRACE("(%p) : AddRef from %d\n", This, ref - 1);
56
57 return ref;
58}
59
60static ULONG WINAPI IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface) {
61 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
62 ULONG ref = InterlockedDecrement(&This->ref);
63
64 TRACE("(%p) : ReleaseRef to %d\n", This, ref);
65
66 if (ref == 0) {
67 IWineD3DResource_Release(This->wineD3DResource);
68 HeapFree(GetProcessHeap(), 0, This);
69 }
70 return ref;
71}
72
73/* IDirect3DResource8 Interface follow: */
74HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
75 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
76 IWineD3DDevice *myDevice = NULL;
77
78 TRACE("(%p) Relay\n", This);
79
80 IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice);
81 IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
82 IWineD3DDevice_Release(myDevice);
83 return D3D_OK;
84}
85
86static HRESULT WINAPI IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
87 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
88 TRACE("(%p) Relay\n", This);
89 return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
90}
91
92static HRESULT WINAPI IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
93 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
94 TRACE("(%p) Relay\n", This);
95 return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
96}
97
98static HRESULT WINAPI IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
99 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
100 TRACE("(%p) Relay\n", This);
101 return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
102}
103
104static DWORD WINAPI IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
105 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
106 TRACE("(%p) Relay\n", This);
107 return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
108}
109
110static DWORD WINAPI IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
111 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
112 TRACE("(%p) Relay\n", This);
113 return IWineD3DResource_GetPriority(This->wineD3DResource);
114}
115
116static void WINAPI IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
117 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
118 TRACE("(%p) Relay\n", This);
119 IWineD3DResource_PreLoad(This->wineD3DResource);
120 return;
121}
122
123static D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface) {
124 IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
125 TRACE("(%p) Relay\n", This);
126 return IWineD3DResource_GetType(This->wineD3DResource);
127}
128
129const IDirect3DResource8Vtbl Direct3DResource8_Vtbl =
130{
131 IDirect3DResource8Impl_QueryInterface,
132 IDirect3DResource8Impl_AddRef,
133 IDirect3DResource8Impl_Release,
134 IDirect3DResource8Impl_GetDevice,
135 IDirect3DResource8Impl_SetPrivateData,
136 IDirect3DResource8Impl_GetPrivateData,
137 IDirect3DResource8Impl_FreePrivateData,
138 IDirect3DResource8Impl_SetPriority,
139 IDirect3DResource8Impl_GetPriority,
140 IDirect3DResource8Impl_PreLoad,
141 IDirect3DResource8Impl_GetType
142};
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