ddraw: Just pass NULL as swapchain parent.
The swapchain was the last place using IParent, so this allows us to kill IParent completely.
This commit is contained in:
parent
b9fae5e9a8
commit
015ad93d47
|
@ -11,7 +11,6 @@ C_SRCS = \
|
||||||
main.c \
|
main.c \
|
||||||
material.c \
|
material.c \
|
||||||
palette.c \
|
palette.c \
|
||||||
parent.c \
|
|
||||||
surface.c \
|
surface.c \
|
||||||
utils.c \
|
utils.c \
|
||||||
vertexbuffer.c \
|
vertexbuffer.c \
|
||||||
|
|
|
@ -2628,14 +2628,11 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This)
|
||||||
ddraw_recreate_surfaces_cb);
|
ddraw_recreate_surfaces_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain)
|
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
|
||||||
{
|
{
|
||||||
IUnknown *swapChainParent;
|
TRACE("swapchain %p.\n", swapchain);
|
||||||
|
|
||||||
TRACE("swapchain %p.\n", pSwapChain);
|
return IWineD3DSwapChain_Release(swapchain);
|
||||||
|
|
||||||
swapChainParent = IWineD3DSwapChain_GetParent(pSwapChain);
|
|
||||||
return IUnknown_Release(swapChainParent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -5919,32 +5916,19 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
{
|
{
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||||
IDirectDrawSurfaceImpl *iterator;
|
IDirectDrawSurfaceImpl *iterator;
|
||||||
IParentImpl *object;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl));
|
|
||||||
if (!object)
|
|
||||||
{
|
|
||||||
FIXME("Allocation of memory failed\n");
|
|
||||||
*swapchain = NULL;
|
|
||||||
return DDERR_OUTOFVIDEOMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
ddraw_parent_init(object);
|
|
||||||
|
|
||||||
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
|
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
|
||||||
This->ImplType, object, swapchain);
|
This->ImplType, NULL, swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
|
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
|
||||||
HeapFree(GetProcessHeap(), 0 , object);
|
|
||||||
*swapchain = NULL;
|
*swapchain = NULL;
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->child = (IUnknown *)*swapchain;
|
|
||||||
This->d3d_target->wineD3DSwapChain = *swapchain;
|
This->d3d_target->wineD3DSwapChain = *swapchain;
|
||||||
iterator = This->d3d_target->complex_array[0];
|
iterator = This->d3d_target->complex_array[0];
|
||||||
while (iterator)
|
while (iterator)
|
||||||
|
|
|
@ -39,30 +39,6 @@
|
||||||
|
|
||||||
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
|
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IParent - a helper interface
|
|
||||||
*****************************************************************************/
|
|
||||||
DEFINE_GUID(IID_IParent, 0xc20e4c88, 0x74e7, 0x4940, 0xba, 0x9f, 0x2e, 0x32, 0x3f, 0x9d, 0xc9, 0x81);
|
|
||||||
typedef struct IParent *LPPARENT, *PPARENT;
|
|
||||||
|
|
||||||
#define INTERFACE IParent
|
|
||||||
DECLARE_INTERFACE_(IParent,IUnknown)
|
|
||||||
{
|
|
||||||
/*** IUnknown methods ***/
|
|
||||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
|
||||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
|
||||||
};
|
|
||||||
#undef INTERFACE
|
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
|
||||||
/*** IUnknown methods ***/
|
|
||||||
#define IParent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
|
||||||
#define IParent_AddRef(p) (p)->lpVtbl->AddRef(p)
|
|
||||||
#define IParent_Release(p) (p)->lpVtbl->Release(p)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Typdef the interfaces */
|
/* Typdef the interfaces */
|
||||||
typedef struct IDirectDrawImpl IDirectDrawImpl;
|
typedef struct IDirectDrawImpl IDirectDrawImpl;
|
||||||
typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
|
typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
|
||||||
|
@ -74,7 +50,6 @@ typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
|
||||||
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
|
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
|
||||||
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
||||||
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
||||||
typedef struct IParentImpl IParentImpl;
|
|
||||||
|
|
||||||
/* Callbacks for implicit object destruction */
|
/* Callbacks for implicit object destruction */
|
||||||
extern ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) DECLSPEC_HIDDEN;
|
extern ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) DECLSPEC_HIDDEN;
|
||||||
|
@ -270,26 +245,6 @@ static inline IDirectDrawSurfaceImpl *surface_from_surface3(IDirectDrawSurface3
|
||||||
#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8))
|
#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8))
|
||||||
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
|
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IParent Implementation
|
|
||||||
*****************************************************************************/
|
|
||||||
struct IParentImpl
|
|
||||||
{
|
|
||||||
/* IUnknown fields */
|
|
||||||
const IParentVtbl *lpVtbl;
|
|
||||||
LONG ref;
|
|
||||||
|
|
||||||
/* IParentImpl fields */
|
|
||||||
IUnknown *child;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void ddraw_parent_init(IParentImpl *parent) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IDirect3DDevice implementation
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#define DDRAW_INVALID_HANDLE ~0U
|
#define DDRAW_INVALID_HANDLE ~0U
|
||||||
|
|
||||||
enum ddraw_handle_type
|
enum ddraw_handle_type
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
/*
|
|
||||||
* IParent implementation
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Stefan Dösinger
|
|
||||||
*
|
|
||||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*
|
|
||||||
* A universal parent interface for everything in WineD3D that doesn't have
|
|
||||||
* a DDraw counterpart
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include "ddraw_private.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IUnknown methods
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IParent::Queryinterface
|
|
||||||
*
|
|
||||||
* It can't query any interfaces, and it's not used for anything. So
|
|
||||||
* it just returns E_NOINTERFACE
|
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
* riid: guid of queried interface
|
|
||||||
* obj: returns a pointer to the interface
|
|
||||||
*
|
|
||||||
* Return values
|
|
||||||
* This implementation always returns E_NOINTERFACE and NULL
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
static HRESULT WINAPI
|
|
||||||
IParentImpl_QueryInterface(IParent *iface,
|
|
||||||
REFIID riid,
|
|
||||||
void **obj)
|
|
||||||
{
|
|
||||||
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
|
|
||||||
|
|
||||||
*obj = NULL;
|
|
||||||
if ( IsEqualGUID( &IID_IUnknown, riid ) ||
|
|
||||||
IsEqualGUID( &IID_IParent, riid ) )
|
|
||||||
{
|
|
||||||
*obj = iface;
|
|
||||||
IParent_AddRef(iface);
|
|
||||||
return DD_OK;
|
|
||||||
}
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IParent::AddRef
|
|
||||||
*
|
|
||||||
* Increases the refcount
|
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
*
|
|
||||||
* Return values
|
|
||||||
* The new refcount
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
static ULONG WINAPI
|
|
||||||
IParentImpl_AddRef(IParent *iface)
|
|
||||||
{
|
|
||||||
IParentImpl *This = (IParentImpl *)iface;
|
|
||||||
ULONG ref = InterlockedIncrement(&This->ref);
|
|
||||||
|
|
||||||
TRACE("%p increasing refcount to %u.\n", This, ref);
|
|
||||||
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IParent::Release
|
|
||||||
*
|
|
||||||
* Releases the refcount, and destroys the object if the refcount falls to 0
|
|
||||||
* Also releases the child object, if destroyed. That's almost the whole sense
|
|
||||||
* of this interface.
|
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
*
|
|
||||||
* Return values
|
|
||||||
* The new refcount
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
static ULONG WINAPI IParentImpl_Release(IParent *iface)
|
|
||||||
{
|
|
||||||
IParentImpl *This = (IParentImpl *)iface;
|
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u.\n", This, ref);
|
|
||||||
|
|
||||||
if (ref == 0)
|
|
||||||
{
|
|
||||||
TRACE("(%p) Releasing child at %p\n", This, This->child);
|
|
||||||
if(This->child)
|
|
||||||
IUnknown_Release(This->child);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
|
||||||
TRACE("Released\n");
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* The VTable
|
|
||||||
*****************************************************************************/
|
|
||||||
static const struct IParentVtbl ddraw_parent_vtbl =
|
|
||||||
{
|
|
||||||
IParentImpl_QueryInterface,
|
|
||||||
IParentImpl_AddRef,
|
|
||||||
IParentImpl_Release,
|
|
||||||
};
|
|
||||||
|
|
||||||
void ddraw_parent_init(IParentImpl *parent)
|
|
||||||
{
|
|
||||||
parent->lpVtbl = &ddraw_parent_vtbl;
|
|
||||||
parent->ref = 1;
|
|
||||||
}
|
|
Loading…
Reference in New Issue