WIN_ListParents no longer needs to be exported, make it static.
[wine] / dlls / d3d9 / swapchain.c
1 /*
2  * IDirect3DSwapChain9 implementation
3  *
4  * Copyright 2002-2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23 #include "d3d9_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
26
27 /* IDirect3DSwapChain IUnknown parts follow: */
28 HRESULT WINAPI IDirect3DSwapChain9Impl_QueryInterface(LPDIRECT3DSWAPCHAIN9 iface, REFIID riid, LPVOID* ppobj)
29 {
30     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
31
32     if (IsEqualGUID(riid, &IID_IUnknown)
33         || IsEqualGUID(riid, &IID_IDirect3DSwapChain9)) {
34         IDirect3DSwapChain9Impl_AddRef(iface);
35         *ppobj = This;
36         return D3D_OK;
37     }
38
39     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40     return E_NOINTERFACE;
41 }
42
43 ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
44     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
45     ULONG ref = InterlockedIncrement(&This->ref);
46
47     TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
48
49     return ref;
50 }
51
52 ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) {
53     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
54     ULONG ref = InterlockedDecrement(&This->ref);
55
56     TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
57
58     if (ref == 0) {
59         HeapFree(GetProcessHeap(), 0, This);
60     }
61     return ref;
62 }
63
64 /* IDirect3DSwapChain9 parts follow: */
65 HRESULT WINAPI IDirect3DSwapChain9Impl_Present(LPDIRECT3DSWAPCHAIN9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags) {
66     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
67     FIXME("(%p) : stub\n", This);
68     return D3D_OK;
69 }
70
71 HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
72     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
73     FIXME("(%p) : stub\n", This);
74     return D3D_OK;
75 }
76
77 HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
78     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
79     FIXME("(%p) : stub\n", This);
80     return D3D_OK;
81 }
82
83 HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
84     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
85     FIXME("(%p) : stub\n", This);
86     return D3D_OK;
87 }
88
89 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN9 iface, D3DDISPLAYMODE* pMode) {
90     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
91     FIXME("(%p) : stub\n", This);
92     return D3D_OK;
93 }
94
95 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DDevice9** ppDevice) {
96     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;  
97     TRACE("(%p) : returning %p\n", This, This->Device);
98     *ppDevice = (LPDIRECT3DDEVICE9) This->Device;
99
100     /* Note  Calling this method will increase the internal reference count 
101        on the IDirect3DDevice9 interface. */
102     IDirect3DDevice9Impl_AddRef(*ppDevice);
103     return D3D_OK;
104 }
105
106 HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWAPCHAIN9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
107     IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
108     FIXME("(%p) : copy\n", This); 
109     memcpy(pPresentationParameters, &This->PresentParms, sizeof(D3DPRESENT_PARAMETERS));
110     return D3D_OK;
111 }
112
113
114 IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl =
115 {
116     IDirect3DSwapChain9Impl_QueryInterface,
117     IDirect3DSwapChain9Impl_AddRef,
118     IDirect3DSwapChain9Impl_Release,
119     IDirect3DSwapChain9Impl_Present,
120     IDirect3DSwapChain9Impl_GetFrontBufferData,
121     IDirect3DSwapChain9Impl_GetBackBuffer,
122     IDirect3DSwapChain9Impl_GetRasterStatus,
123     IDirect3DSwapChain9Impl_GetDisplayMode,
124     IDirect3DSwapChain9Impl_GetDevice,
125     IDirect3DSwapChain9Impl_GetPresentParameters
126 };
127
128
129 /* IDirect3DDevice9 IDirect3DSwapChain9 Methods follow: */
130 HRESULT  WINAPI  IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
131     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
132     FIXME("(%p) : stub\n", This);
133     return D3D_OK;
134 }
135
136 HRESULT  WINAPI  IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
137     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
138     FIXME("(%p) : stub\n", This);
139     return D3D_OK;
140 }
141
142 UINT     WINAPI  IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface) {
143     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
144     FIXME("(%p) : stub\n", This);
145     return 1;
146 }