Get rid of HEAP_strdupWtoA calls.
[wine/multimedia.git] / dlls / d3d9 / swapchain.c
blob2eb4ca3cdb1fd2c0fbe375c610654cf1ddea8d0a
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"
23 #include "d3d9_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
27 /* IDirect3DSwapChain IUnknown parts follow: */
28 HRESULT WINAPI IDirect3DSwapChain9Impl_QueryInterface(LPDIRECT3DSWAPCHAIN9 iface, REFIID riid, LPVOID* ppobj)
30 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
32 if (IsEqualGUID(riid, &IID_IUnknown)
33 || IsEqualGUID(riid, &IID_IDirect3DSwapChain9)) {
34 IDirect3DSwapChain9Impl_AddRef(iface);
35 *ppobj = This;
36 return D3D_OK;
39 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40 return E_NOINTERFACE;
43 ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
44 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
45 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
46 return ++(This->ref);
49 ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) {
50 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
51 ULONG ref = --This->ref;
52 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
53 if (ref == 0) {
54 HeapFree(GetProcessHeap(), 0, This);
56 return ref;
59 /* IDirect3DSwapChain9 parts follow: */
60 HRESULT WINAPI IDirect3DSwapChain9Impl_Present(LPDIRECT3DSWAPCHAIN9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags) {
61 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
62 FIXME("(%p) : stub\n", This);
63 return D3D_OK;
66 HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
67 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
68 FIXME("(%p) : stub\n", This);
69 return D3D_OK;
72 HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
73 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
74 FIXME("(%p) : stub\n", This);
75 return D3D_OK;
78 HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
79 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
80 FIXME("(%p) : stub\n", This);
81 return D3D_OK;
84 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN9 iface, D3DDISPLAYMODE* pMode) {
85 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
86 FIXME("(%p) : stub\n", This);
87 return D3D_OK;
90 HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DDevice9** ppDevice) {
91 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
92 TRACE("(%p) : returning %p\n", This, This->Device);
93 *ppDevice = (LPDIRECT3DDEVICE9) This->Device;
95 /* Note Calling this method will increase the internal reference count
96 on the IDirect3DDevice9 interface. */
97 IDirect3DDevice9Impl_AddRef(*ppDevice);
98 return D3D_OK;
101 HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWAPCHAIN9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
102 IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
103 FIXME("(%p) : copy\n", This);
104 memcpy(pPresentationParameters, &This->PresentParms, sizeof(D3DPRESENT_PARAMETERS));
105 return D3D_OK;
109 IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl =
111 IDirect3DSwapChain9Impl_QueryInterface,
112 IDirect3DSwapChain9Impl_AddRef,
113 IDirect3DSwapChain9Impl_Release,
114 IDirect3DSwapChain9Impl_Present,
115 IDirect3DSwapChain9Impl_GetFrontBufferData,
116 IDirect3DSwapChain9Impl_GetBackBuffer,
117 IDirect3DSwapChain9Impl_GetRasterStatus,
118 IDirect3DSwapChain9Impl_GetDisplayMode,
119 IDirect3DSwapChain9Impl_GetDevice,
120 IDirect3DSwapChain9Impl_GetPresentParameters
124 /* IDirect3DDevice9 IDirect3DSwapChain9 Methods follow: */
125 HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
126 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
127 FIXME("(%p) : stub\n", This);
128 return D3D_OK;
131 HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
132 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
133 FIXME("(%p) : stub\n", This);
134 return D3D_OK;
137 UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface) {
138 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
139 FIXME("(%p) : stub\n", This);
140 return 1;