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