Removed some more uses of the non-standard ICOM_THIS macro.
[wine/multimedia.git] / dlls / d3d9 / swapchain.c
blobf670bd1931e64ff41bf1936c168293e313d7c956
1 /*
2 * IDirect3DSwapChain9 implementation
4 * Copyright 2002-2003 Jason Edmeades
5 * Raphael Junqueira
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.
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.
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
22 #include "config.h"
24 #include <stdarg.h>
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "wingdi.h"
32 #include "wine/debug.h"
34 #include "d3d9_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
38 /* IDirect3DSwapChain IUnknown parts follow: */
39 HRESULT WINAPI IDirect3DSwapChain9Impl_QueryInterface(LPDIRECT3DSWAPCHAIN9 iface, REFIID riid, LPVOID* ppobj)
41 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
43 if (IsEqualGUID(riid, &IID_IUnknown)
44 || IsEqualGUID(riid, &IID_IDirect3DSwapChain9)) {
45 IDirect3DSwapChain9Impl_AddRef(iface);
46 *ppobj = This;
47 return D3D_OK;
50 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
51 return E_NOINTERFACE;
54 ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
55 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
56 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
57 return ++(This->ref);
60 ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) {
61 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
62 ULONG ref = --This->ref;
63 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
64 if (ref == 0) {
65 HeapFree(GetProcessHeap(), 0, This);
67 return ref;
70 /* IDirect3DSwapChain9 parts follow: */
71 HRESULT WINAPI IDirect3DSwapChain9Impl_Present(LPDIRECT3DSWAPCHAIN9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags) {
72 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
73 FIXME("(%p) : stub\n", This);
74 return D3D_OK;
77 HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
78 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
79 FIXME("(%p) : stub\n", This);
80 return D3D_OK;
83 HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
84 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
85 FIXME("(%p) : stub\n", This);
86 return D3D_OK;
89 HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
90 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
91 FIXME("(%p) : stub\n", This);
92 return D3D_OK;
95 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN9 iface, D3DDISPLAYMODE* pMode) {
96 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
97 FIXME("(%p) : stub\n", This);
98 return D3D_OK;
101 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DDevice9** ppDevice) {
102 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
103 TRACE("(%p) : returning %p\n", This, This->Device);
104 *ppDevice = (LPDIRECT3DDEVICE9) This->Device;
106 /* Note Calling this method will increase the internal reference count
107 on the IDirect3DDevice9 interface. */
108 IDirect3DDevice9Impl_AddRef(*ppDevice);
109 return D3D_OK;
112 HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWAPCHAIN9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
113 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
114 FIXME("(%p) : copy\n", This);
115 memcpy(pPresentationParameters, &This->PresentParms, sizeof(D3DPRESENT_PARAMETERS));
116 return D3D_OK;
120 IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl =
122 IDirect3DSwapChain9Impl_QueryInterface,
123 IDirect3DSwapChain9Impl_AddRef,
124 IDirect3DSwapChain9Impl_Release,
125 IDirect3DSwapChain9Impl_Present,
126 IDirect3DSwapChain9Impl_GetFrontBufferData,
127 IDirect3DSwapChain9Impl_GetBackBuffer,
128 IDirect3DSwapChain9Impl_GetRasterStatus,
129 IDirect3DSwapChain9Impl_GetDisplayMode,
130 IDirect3DSwapChain9Impl_GetDevice,
131 IDirect3DSwapChain9Impl_GetPresentParameters
135 /* IDirect3DDevice9 IDirect3DSwapChain9 Methods follow: */
136 HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
137 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
138 FIXME("(%p) : stub\n", This);
139 return D3D_OK;
142 HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
143 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
144 FIXME("(%p) : stub\n", This);
145 return D3D_OK;
148 UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface) {
149 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
150 FIXME("(%p) : stub\n", This);
151 return 1;