Sweden-Number/dlls/d3d8/swapchain.c

97 lines
3.3 KiB
C
Raw Normal View History

2002-09-28 00:46:16 +02:00
/*
* IDirect3DSwapChain8 implementation
*
* Copyright 2002 Jason Edmeades
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
2002-09-28 00:46:16 +02:00
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* IDirect3DSwapChain IUnknown parts follow: */
HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface,REFIID riid,LPVOID *ppobj)
{
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
2002-09-28 00:46:16 +02:00
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DSwapChain8)) {
2002-09-28 00:46:16 +02:00
IDirect3DSwapChain8Impl_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(LPDIRECT3DSWAPCHAIN8 iface) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
2002-09-28 00:46:16 +02:00
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
}
ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
2002-09-28 00:46:16 +02:00
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
2002-09-28 00:46:16 +02:00
HeapFree(GetProcessHeap(), 0, This);
}
2002-09-28 00:46:16 +02:00
return ref;
}
/* IDirect3DSwapChain parts follow: */
HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
2002-09-28 00:46:16 +02:00
}
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
*ppBackBuffer = (LPDIRECT3DSURFACE8) This->backBuffer;
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
FIXME("Only one backBuffer currently supported\n");
return D3DERR_INVALIDCALL;
}
/* Note inc ref on returned surface */
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer);
return D3D_OK;
2002-09-28 00:46:16 +02:00
}
IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
2002-09-28 00:46:16 +02:00
{
IDirect3DSwapChain8Impl_QueryInterface,
IDirect3DSwapChain8Impl_AddRef,
IDirect3DSwapChain8Impl_Release,
IDirect3DSwapChain8Impl_Present,
IDirect3DSwapChain8Impl_GetBackBuffer
};