VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/resource.c@ 16684

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

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