wined3d: Remove COM from the surface implementation.

This commit is contained in:
Henri Verbeet 2011-04-29 13:03:41 +02:00 committed by Alexandre Julliard
parent ab199f56a6
commit 1c1de920e3
26 changed files with 557 additions and 752 deletions

View File

@ -87,7 +87,7 @@ struct d3d10_texture2d
LONG refcount;
IUnknown *dxgi_surface;
IWineD3DSurface *wined3d_surface;
struct wined3d_surface *wined3d_surface;
D3D10_TEXTURE2D_DESC desc;
};

View File

@ -1322,7 +1322,7 @@ static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceP
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
{
struct d3d10_device *This = device_from_device_parent(iface);
struct d3d10_texture2d *texture;
@ -1355,7 +1355,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
}
*surface = texture->wined3d_surface;
IWineD3DSurface_AddRef(*surface);
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
return S_OK;
@ -1364,7 +1364,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
IWineD3DSurface **surface)
struct wined3d_surface **surface)
{
struct d3d10_device *This = device_from_device_parent(iface);
struct d3d10_texture2d *texture;
@ -1397,7 +1397,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
}
*surface = texture->wined3d_surface;
IWineD3DSurface_AddRef(*surface);
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
return S_OK;
@ -1405,7 +1405,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{
struct d3d10_device *This = device_from_device_parent(iface);
struct d3d10_texture2d *texture;
@ -1438,7 +1438,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
}
*surface = texture->wined3d_surface;
IWineD3DSurface_AddRef(*surface);
wined3d_surface_incref(*surface);
ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
return S_OK;

View File

@ -61,7 +61,8 @@ static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface)
TRACE("%p increasing refcount to %u\n", This, refcount);
if (refcount == 1 && This->wined3d_surface) IWineD3DSurface_AddRef(This->wined3d_surface);
if (refcount == 1 && This->wined3d_surface)
wined3d_surface_incref(This->wined3d_surface);
return refcount;
}
@ -83,8 +84,10 @@ static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
if (!refcount)
{
if (This->wined3d_surface) IWineD3DSurface_Release(This->wined3d_surface);
else d3d10_texture2d_wined3d_object_released(This);
if (This->wined3d_surface)
wined3d_surface_decref(This->wined3d_surface);
else
d3d10_texture2d_wined3d_object_released(This);
}
return refcount;

View File

@ -37,7 +37,7 @@ static struct wined3d_resource *wined3d_resource_from_resource(ID3D10Resource *r
return wined3d_buffer_get_resource(((struct d3d10_buffer *)resource)->wined3d_buffer);
case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
return IWineD3DSurface_GetResource(((struct d3d10_texture2d *)resource)->wined3d_surface);
return wined3d_surface_get_resource(((struct d3d10_texture2d *)resource)->wined3d_surface);
default:
FIXME("Unhandled resource dimension %#x.\n", dimension);

View File

@ -242,12 +242,8 @@ struct IDirect3DSurface8Impl
/* IUnknown fields */
const IDirect3DSurface8Vtbl *lpVtbl;
LONG ref;
/* IDirect3DSurface8 fields */
IWineD3DSurface *wineD3DSurface;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
struct wined3d_surface *wined3d_surface;
IDirect3DDevice8 *parentDevice;
/* The surface container */
IUnknown *container;

View File

@ -478,7 +478,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(IDirect3DDevice8
}
wined3d_mutex_lock();
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,pSurface->wineD3DSurface);
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice, XHotSpot, YHotSpot, pSurface->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -611,19 +611,20 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(IDirect3DDevice8 *iface
UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3DSurface *retSurface = NULL;
struct wined3d_surface *wined3d_surface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, BackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &retSurface);
if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0,
BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface && ppBackBuffer)
{
*ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
*ppBackBuffer = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();
@ -930,11 +931,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface,
* destination texture is in WINED3DPOOL_DEFAULT. */
wined3d_mutex_lock();
wined3d_resource = IWineD3DSurface_GetResource(Source->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(Source->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
srcFormat = wined3d_desc.format;
wined3d_resource = IWineD3DSurface_GetResource(Dest->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(Dest->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
destFormat = wined3d_desc.format;
@ -949,22 +950,33 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface,
else if (WINED3DFMT_UNKNOWN == destFormat)
{
TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface);
IWineD3DSurface_SetFormat(Dest->wineD3DSurface, srcFormat);
wined3d_surface_set_format(Dest->wined3d_surface, srcFormat);
}
/* Quick if complete copy ... */
if (cRects == 0 && pSourceRects == NULL && pDestPoints == NULL) {
IWineD3DSurface_BltFast(Dest->wineD3DSurface, 0, 0, Source->wineD3DSurface, NULL, WINEDDBLTFAST_NOCOLORKEY);
} else {
if (!cRects && !pSourceRects && !pDestPoints)
{
wined3d_surface_bltfast(Dest->wined3d_surface, 0, 0,
Source->wined3d_surface, NULL, WINEDDBLTFAST_NOCOLORKEY);
}
else
{
unsigned int i;
/* Copy rect by rect */
if (NULL != pSourceRects && NULL != pDestPoints) {
for (i = 0; i < cRects; ++i) {
IWineD3DSurface_BltFast(Dest->wineD3DSurface, pDestPoints[i].x, pDestPoints[i].y, Source->wineD3DSurface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY);
if (pSourceRects && pDestPoints)
{
for (i = 0; i < cRects; ++i)
{
wined3d_surface_bltfast(Dest->wined3d_surface, pDestPoints[i].x, pDestPoints[i].y,
Source->wined3d_surface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY);
}
} else {
for (i = 0; i < cRects; ++i) {
IWineD3DSurface_BltFast(Dest->wineD3DSurface, 0, 0, Source->wineD3DSurface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY);
}
else
{
for (i = 0; i < cRects; ++i)
{
wined3d_surface_bltfast(Dest->wined3d_surface, 0, 0,
Source->wined3d_surface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY);
}
}
}
@ -1005,7 +1017,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(IDirect3DDevice8 *ifac
}
wined3d_mutex_lock();
hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, 0, destSurface->wineD3DSurface);
hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, 0, destSurface->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -1017,7 +1029,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl *)pRenderTarget;
IDirect3DSurface8Impl *pZSurface = (IDirect3DSurface8Impl *)pNewZStencil;
IWineD3DSurface *original_ds = NULL;
struct wined3d_surface *original_ds = NULL;
HRESULT hr;
TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, pRenderTarget, pNewZStencil);
@ -1042,9 +1054,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
pSurface = (IDirect3DSurface8Impl *)orig_rt;
}
wined3d_resource = IWineD3DSurface_GetResource(pZSurface->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(pZSurface->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &ds_desc);
wined3d_resource = IWineD3DSurface_GetResource(pSurface->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(pSurface->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &rt_desc);
if (orig_rt) IDirect3DSurface8_Release(orig_rt);
@ -1059,14 +1071,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds);
if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
{
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wineD3DSurface : NULL);
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wined3d_surface : NULL);
if (SUCCEEDED(hr) && pRenderTarget)
{
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface, TRUE);
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wined3d_surface, TRUE);
if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds);
}
}
if (original_ds) IWineD3DSurface_Release(original_ds);
if (original_ds)
wined3d_surface_decref(original_ds);
wined3d_mutex_unlock();
@ -1077,7 +1090,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *ifa
IDirect3DSurface8 **ppRenderTarget)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3DSurface *pRenderTarget;
struct wined3d_surface *wined3d_surface;
HRESULT hr;
TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget);
@ -1087,12 +1100,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *ifa
}
wined3d_mutex_lock();
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget);
if (SUCCEEDED(hr) && pRenderTarget)
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface)
{
*ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
*ppRenderTarget = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface8_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget);
wined3d_surface_decref(wined3d_surface);
}
else
{
@ -1108,7 +1121,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevic
IDirect3DSurface8 **ppZStencilSurface)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3DSurface *pZStencilSurface;
struct wined3d_surface *wined3d_surface;
HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@ -1118,12 +1131,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevic
}
wined3d_mutex_lock();
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &pZStencilSurface);
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &wined3d_surface);
if (SUCCEEDED(hr))
{
*ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
*ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface8_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface);
wined3d_surface_decref(wined3d_surface);
}
else
{
@ -2806,7 +2819,7 @@ static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceP
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
{
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
IDirect3DSurface8Impl *d3d_surface;
@ -2829,8 +2842,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = container_parent;
IUnknown_Release(d3d_surface->parentDevice);
@ -2845,7 +2858,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
IWineD3DSurface **surface)
struct wined3d_surface **surface)
{
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
IDirect3DSurface8Impl *d3d_surface;
@ -2863,8 +2876,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
/* Implicit surfaces are created with an refcount of 0 */
@ -2875,7 +2888,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
IDirect3DSurface8Impl *d3d_surface;
@ -2893,8 +2906,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
/* Implicit surfaces are created with an refcount of 0 */

View File

@ -61,7 +61,7 @@ static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) {
{
if (This->parentDevice) IUnknown_AddRef(This->parentDevice);
wined3d_mutex_lock();
IUnknown_AddRef(This->wineD3DSurface);
wined3d_surface_incref(This->wined3d_surface);
wined3d_mutex_unlock();
}
@ -89,7 +89,7 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) {
/* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */
wined3d_mutex_lock();
IWineD3DSurface_Release(This->wineD3DSurface);
wined3d_surface_decref(This->wined3d_surface);
wined3d_mutex_unlock();
if (parentDevice) IDirect3DDevice8_Release(parentDevice);
@ -139,7 +139,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 if
iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
wined3d_mutex_lock();
hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags);
hr = wined3d_surface_set_private_data(This->wined3d_surface, refguid, pData, SizeOfData, Flags);
wined3d_mutex_unlock();
return hr;
@ -153,7 +153,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 if
iface, debugstr_guid(refguid), pData, pSizeOfData);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData);
hr = wined3d_surface_get_private_data(This->wined3d_surface, refguid, pData, pSizeOfData);
wined3d_mutex_unlock();
return hr;
@ -166,7 +166,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 i
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
wined3d_mutex_lock();
hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid);
hr = wined3d_surface_free_private_data(This->wined3d_surface, refguid);
wined3d_mutex_unlock();
return hr;
@ -196,7 +196,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_resource = IWineD3DSurface_GetResource(This->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(This->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
@ -236,7 +236,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D
}
}
hr = IWineD3DSurface_Map(This->wineD3DSurface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
hr = wined3d_surface_map(This->wined3d_surface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
wined3d_mutex_unlock();
return hr;
@ -249,7 +249,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DSurface_Unmap(This->wineD3DSurface);
hr = wined3d_surface_unmap(This->wined3d_surface);
wined3d_mutex_unlock();
switch(hr)
@ -306,7 +306,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wineD3DSurface);
multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -109,7 +109,7 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
{
IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface);
IWineD3DSurface *mySurface = NULL;
struct wined3d_surface *wined3d_surface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
@ -117,12 +117,12 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8
wined3d_mutex_lock();
hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
if (SUCCEEDED(hr) && mySurface)
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
*ppBackBuffer = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();

View File

@ -225,12 +225,8 @@ typedef struct IDirect3DSurface9Impl
/* IUnknown fields */
const IDirect3DSurface9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DSurface *wineD3DSurface;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
struct wined3d_surface *wined3d_surface;
IDirect3DDevice9Ex *parentDevice;
/* The surface container */
IUnknown *container;

View File

@ -435,7 +435,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(IDirect3DDevice9E
}
wined3d_mutex_lock();
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice, XHotSpot, YHotSpot, pSurface->wineD3DSurface);
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice, XHotSpot, YHotSpot, pSurface->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -698,7 +698,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(IDirect3DDevice9Ex *ifa
UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IWineD3DSurface *retSurface = NULL;
struct wined3d_surface *wined3d_surface = NULL;
HRESULT hr;
TRACE("iface %p, swapchain %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
@ -706,12 +706,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(IDirect3DDevice9Ex *ifa
wined3d_mutex_lock();
hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain,
BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface && ppBackBuffer)
{
*ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
*ppBackBuffer = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();
@ -1021,7 +1021,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(IDirect3DDevice9Ex *ifa
iface, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
wined3d_mutex_lock();
hr = IWineD3DDevice_UpdateSurface(This->WineD3DDevice, ((IDirect3DSurface9Impl *)pSourceSurface)->wineD3DSurface, pSourceRect, ((IDirect3DSurface9Impl *)pDestinationSurface)->wineD3DSurface, pDestPoint);
hr = IWineD3DDevice_UpdateSurface(This->WineD3DDevice,
((IDirect3DSurface9Impl *)pSourceSurface)->wined3d_surface, pSourceRect,
((IDirect3DSurface9Impl *)pDestinationSurface)->wined3d_surface, pDestPoint);
wined3d_mutex_unlock();
return hr;
@ -1054,7 +1056,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(IDirect3DDevice9E
TRACE("iface %p, render_target %p, dst_surface %p.\n", iface, pRenderTarget, pDestSurface);
wined3d_mutex_lock();
hr = IWineD3DSurface_BltFast(destSurface->wineD3DSurface, 0, 0, renderTarget->wineD3DSurface, NULL, WINEDDBLTFAST_NOCOLORKEY);
hr = wined3d_surface_bltfast(destSurface->wined3d_surface, 0, 0,
renderTarget->wined3d_surface, NULL, WINEDDBLTFAST_NOCOLORKEY);
wined3d_mutex_unlock();
return hr;
@ -1070,7 +1073,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(IDirect3DDevice9Ex
TRACE("iface %p, swapchain %u, dst_surface %p.\n", iface, iSwapChain, pDestSurface);
wined3d_mutex_lock();
hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, iSwapChain, destSurface->wineD3DSurface);
hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, iSwapChain, destSurface->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -1087,7 +1090,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface
iface, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter);
wined3d_mutex_lock();
hr = IWineD3DSurface_Blt(dst->wineD3DSurface, pDestRect, src->wineD3DSurface, pSourceRect, 0, NULL, Filter);
hr = wined3d_surface_blt(dst->wined3d_surface, pDestRect, src->wined3d_surface, pSourceRect, 0, NULL, Filter);
wined3d_mutex_unlock();
return hr;
@ -1113,7 +1116,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface,
wined3d_mutex_lock();
wined3d_resource = IWineD3DSurface_GetResource(surface->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(surface->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &desc);
/* This method is only allowed with surfaces that are render targets, or
@ -1126,7 +1129,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface,
}
/* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */
hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, pRect, &c);
hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wined3d_surface, pRect, &c);
wined3d_mutex_unlock();
@ -1178,7 +1181,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(IDirect3DDevice9Ex *i
}
wined3d_mutex_lock();
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? pSurface->wineD3DSurface : NULL, TRUE);
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex,
pSurface ? pSurface->wined3d_surface : NULL, TRUE);
wined3d_mutex_unlock();
return hr;
@ -1188,7 +1192,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i
DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IWineD3DSurface *pRenderTarget;
struct wined3d_surface *wined3d_surface;
HRESULT hr;
TRACE("iface %p, idx %u, surface %p.\n", iface, RenderTargetIndex, ppRenderTarget);
@ -1205,21 +1209,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i
wined3d_mutex_lock();
hr=IWineD3DDevice_GetRenderTarget(This->WineD3DDevice,RenderTargetIndex,&pRenderTarget);
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, RenderTargetIndex, &wined3d_surface);
if (FAILED(hr))
{
FIXME("Call to IWineD3DDevice_GetRenderTarget failed, hr %#x\n", hr);
}
else if (!pRenderTarget)
else if (!wined3d_surface)
{
*ppRenderTarget = NULL;
}
else
{
*ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
*ppRenderTarget = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface9_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();
@ -1239,7 +1243,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(IDirect3DDevic
pSurface = (IDirect3DSurface9Impl*)pZStencilSurface;
wined3d_mutex_lock();
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, NULL==pSurface ? NULL : pSurface->wineD3DSurface);
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pSurface ? pSurface->wined3d_surface : NULL);
wined3d_mutex_unlock();
return hr;
@ -1249,7 +1253,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevic
IDirect3DSurface9 **ppZStencilSurface)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IWineD3DSurface *pZStencilSurface;
struct wined3d_surface *wined3d_surface;
HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@ -1259,12 +1263,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevic
}
wined3d_mutex_lock();
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &wined3d_surface);
if (SUCCEEDED(hr))
{
*ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
*ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface9_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface);
wined3d_surface_decref(wined3d_surface);
}
else
{
@ -3171,7 +3175,7 @@ static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceP
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
IDirect3DSurface9Impl *d3d_surface;
@ -3194,8 +3198,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = container_parent;
IDirect3DDevice9Ex_Release(d3d_surface->parentDevice);
@ -3210,7 +3214,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
IWineD3DSurface **surface)
struct wined3d_surface **surface)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
IDirect3DSurface9Impl *d3d_surface;
@ -3229,8 +3233,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = container_parent;
/* Implicit surfaces are created with an refcount of 0 */
@ -3241,7 +3245,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
IDirect3DSurface9Impl *d3d_surface;
@ -3260,8 +3264,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
return hr;
}
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = d3d_surface->wined3d_surface;
wined3d_surface_incref(*surface);
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice9Ex_iface;
/* Implicit surfaces are created with an refcount of 0 */
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);

View File

@ -62,7 +62,7 @@ static ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) {
{
if (This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice);
wined3d_mutex_lock();
IWineD3DSurface_AddRef(This->wineD3DSurface);
wined3d_surface_incref(This->wined3d_surface);
wined3d_mutex_unlock();
}
@ -90,7 +90,7 @@ static ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
wined3d_mutex_lock();
IWineD3DSurface_Release(This->wineD3DSurface);
wined3d_surface_decref(This->wined3d_surface);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
@ -141,7 +141,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 if
iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
wined3d_mutex_lock();
hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags);
hr = wined3d_surface_set_private_data(This->wined3d_surface, refguid, pData, SizeOfData, Flags);
wined3d_mutex_unlock();
return hr;
@ -155,7 +155,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 if
iface, debugstr_guid(refguid), pData, pSizeOfData);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData);
hr = wined3d_surface_get_private_data(This->wined3d_surface, refguid, pData, pSizeOfData);
wined3d_mutex_unlock();
return hr;
@ -168,7 +168,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 i
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
wined3d_mutex_lock();
hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid);
hr = wined3d_surface_free_private_data(This->wined3d_surface, refguid);
wined3d_mutex_unlock();
return hr;
@ -181,7 +181,7 @@ static DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface,
TRACE("iface %p, priority %u.\n", iface, PriorityNew);
wined3d_mutex_lock();
hr = IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew);
hr = wined3d_surface_set_priority(This->wined3d_surface, PriorityNew);
wined3d_mutex_unlock();
return hr;
@ -194,7 +194,7 @@ static DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetPriority(This->wineD3DSurface);
hr = wined3d_surface_get_priority(This->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -206,7 +206,7 @@ static void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) {
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DSurface_PreLoad(This->wineD3DSurface);
wined3d_surface_preload(This->wined3d_surface);
wined3d_mutex_unlock();
}
@ -242,7 +242,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(IDirect3DSurface9 *iface, D3
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_resource = IWineD3DSurface_GetResource(This->wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(This->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
@ -265,7 +265,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D
TRACE("iface %p, locked_rect %p, rect %p, flags %#x.\n", iface, pLockedRect, pRect, Flags);
wined3d_mutex_lock();
hr = IWineD3DSurface_Map(This->wineD3DSurface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
hr = wined3d_surface_map(This->wined3d_surface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
wined3d_mutex_unlock();
return hr;
@ -278,7 +278,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DSurface_Unmap(This->wineD3DSurface);
hr = wined3d_surface_unmap(This->wined3d_surface);
wined3d_mutex_unlock();
switch(hr)
@ -302,7 +302,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC*
}
wined3d_mutex_lock();
hr = IWineD3DSurface_GetDC(This->wineD3DSurface, phdc);
hr = wined3d_surface_getdc(This->wined3d_surface, phdc);
wined3d_mutex_unlock();
return hr;
@ -315,7 +315,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface,
TRACE("iface %p, hdc %p.\n", iface, hdc);
wined3d_mutex_lock();
hr = IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc);
hr = wined3d_surface_releasedc(This->wined3d_surface, hdc);
wined3d_mutex_unlock();
switch (hr)
@ -394,7 +394,7 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wineD3DSurface);
multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -106,7 +106,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
wined3d_mutex_lock();
hr = wined3d_swapchain_get_front_buffer_data(This->wined3d_swapchain,
((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface);
((IDirect3DSurface9Impl *)pDestSurface)->wined3d_surface);
wined3d_mutex_unlock();
return hr;
@ -116,7 +116,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer)
{
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
IWineD3DSurface *mySurface = NULL;
struct wined3d_surface *wined3d_surface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
@ -124,12 +124,12 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9
wined3d_mutex_lock();
hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
if (SUCCEEDED(hr) && mySurface)
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
*ppBackBuffer = wined3d_surface_get_parent(wined3d_surface);
IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();

View File

@ -1957,7 +1957,7 @@ static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface)
static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface)
{
IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
IWineD3DSurface *Surf;
struct wined3d_surface *wined3d_surface;
IDirectDrawSurface7 *ddsurf;
HRESULT hr;
DDSCAPS2 ddsCaps;
@ -1969,21 +1969,16 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa
*/
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DDevice_GetBackBuffer(This->wineD3DDevice,
0, /* SwapChain */
0, /* first back buffer*/
WINED3DBACKBUFFER_TYPE_MONO,
&Surf);
if( (hr != D3D_OK) ||
(!Surf) )
0, 0, WINED3DBACKBUFFER_TYPE_MONO, &wined3d_surface);
if (FAILED(hr) || !wined3d_surface)
{
ERR("IWineD3DDevice::GetBackBuffer failed\n");
LeaveCriticalSection(&ddraw_cs);
return DDERR_NOTFOUND;
}
ddsurf = IWineD3DSurface_GetParent(Surf);
IWineD3DSurface_Release(Surf);
ddsurf = wined3d_surface_get_parent(wined3d_surface);
wined3d_surface_decref(wined3d_surface);
/* Find the front buffer */
ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
@ -2384,7 +2379,7 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc,
IDirectDrawSurface7 **Surface)
{
IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
IWineD3DSurface *wined3d_surface;
struct wined3d_surface *wined3d_surface;
HRESULT hr;
TRACE("iface %p, dc %p, surface %p.\n", iface, hdc, Surface);
@ -2399,7 +2394,7 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc,
return DDERR_NOTFOUND;
}
*Surface = IWineD3DSurface_GetParent(wined3d_surface);
*Surface = wined3d_surface_get_parent(wined3d_surface);
IDirectDrawSurface7_AddRef(*Surface);
TRACE("Returning surface %p.\n", Surface);
return DD_OK;
@ -2518,9 +2513,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
IDirectDrawImpl *This = surfImpl->ddraw;
struct wined3d_clipper *clipper = NULL;
IWineD3DSurface *wineD3DSurface;
struct wined3d_surface *wined3d_surface;
struct wined3d_swapchain *swapchain;
struct wined3d_clipper *clipper;
void *parent;
HRESULT hr;
@ -2535,27 +2530,27 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
/* Get the objects */
swapchain = surfImpl->wined3d_swapchain;
surfImpl->wined3d_swapchain = NULL;
wineD3DSurface = surfImpl->WineD3DSurface;
wined3d_surface = surfImpl->wined3d_surface;
/* get the clipper */
IWineD3DSurface_GetClipper(wineD3DSurface, &clipper);
clipper = wined3d_surface_get_clipper(wined3d_surface);
/* Get the surface properties */
wined3d_resource = IWineD3DSurface_GetResource(wineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
parent = IWineD3DSurface_GetParent(wineD3DSurface);
parent = wined3d_surface_get_parent(wined3d_surface);
hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, wined3d_desc.width, wined3d_desc.height,
wined3d_desc.format, TRUE, FALSE, surfImpl->mipmap_level, wined3d_desc.usage, wined3d_desc.pool,
wined3d_desc.multisample_type, wined3d_desc.multisample_quality, This->ImplType,
parent, &ddraw_surface_wined3d_parent_ops, &surfImpl->WineD3DSurface);
parent, &ddraw_surface_wined3d_parent_ops, &surfImpl->wined3d_surface);
if (FAILED(hr))
{
surfImpl->WineD3DSurface = wineD3DSurface;
surfImpl->wined3d_surface = wined3d_surface;
return hr;
}
IWineD3DSurface_SetClipper(surfImpl->WineD3DSurface, clipper);
wined3d_surface_set_clipper(surfImpl->wined3d_surface, clipper);
/* TODO: Copy the surface content, except for render targets */
@ -2569,8 +2564,10 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
if (surfImpl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
IWineD3DDevice_UninitGDI(This->wineD3DDevice);
surfImpl->isRenderTarget = FALSE;
} else {
if(IWineD3DSurface_Release(wineD3DSurface) == 0)
}
else
{
if (!wined3d_surface_decref(wined3d_surface))
TRACE("Surface released successful, next surface\n");
else
ERR("Something's still holding the old WineD3DSurface\n");
@ -2578,9 +2575,6 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
surfImpl->ImplType = This->ImplType;
if (clipper)
wined3d_clipper_decref(clipper);
return DDENUMRET_OK;
}
@ -5660,7 +5654,7 @@ static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceP
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
{
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
IDirectDrawSurfaceImpl *surf = NULL;
@ -5720,8 +5714,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
}
/* Return the surface */
*surface = surf->WineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = surf->wined3d_surface;
wined3d_surface_incref(*surface);
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, surf);
@ -5752,7 +5746,7 @@ static HRESULT WINAPI findRenderTarget(IDirectDrawSurface7 *surface, DDSURFACEDE
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
IWineD3DSurface **surface)
struct wined3d_surface **surface)
{
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
IDirectDrawSurfaceImpl *d3d_surface = This->d3d_target;
@ -5779,8 +5773,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
/* TODO: Return failure if the dimensions do not match, but this shouldn't happen */
*surface = target->WineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = target->wined3d_surface;
wined3d_surface_incref(*surface);
target->isRenderTarget = TRUE;
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, d3d_surface);
@ -5790,7 +5784,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
IDirectDrawSurfaceImpl *ddraw_surface;
@ -5830,8 +5824,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
return hr;
}
*surface = ddraw_surface->WineD3DSurface;
IWineD3DSurface_AddRef(*surface);
*surface = ddraw_surface->wined3d_surface;
wined3d_surface_incref(*surface);
IDirectDrawSurface7_Release((IDirectDrawSurface7 *)ddraw_surface);
return D3D_OK;

View File

@ -180,7 +180,7 @@ struct IDirectDrawSurfaceImpl
/* Connections to other Objects */
IDirectDrawImpl *ddraw;
IWineD3DSurface *WineD3DSurface;
struct wined3d_surface *wined3d_surface;
struct wined3d_texture *wined3d_texture;
struct wined3d_swapchain *wined3d_swapchain;

View File

@ -298,7 +298,7 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
/* Set the device up to render to the front buffer since the back
* buffer will vanish soon. */
IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
This->ddraw->d3d_target->WineD3DSurface, TRUE);
This->ddraw->d3d_target->wined3d_surface, TRUE);
/* Release the WineD3DDevice. This won't destroy it */
if(IWineD3DDevice_Release(This->wineD3DDevice) <= 0)
@ -1861,10 +1861,8 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
return D3D_OK;
}
hr = IWineD3DDevice_SetRenderTarget(This->wineD3DDevice,
0,
Target ? Target->WineD3DSurface : NULL,
FALSE);
hr = IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
Target ? Target->wined3d_surface : NULL, FALSE);
if(hr != D3D_OK)
{
LeaveCriticalSection(&ddraw_cs);
@ -5563,7 +5561,7 @@ IDirect3DDeviceImpl_7_PreLoad(IDirect3DDevice7 *iface,
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
IWineD3DSurface_PreLoad(surf->WineD3DSurface);
wined3d_surface_preload(surf->wined3d_surface);
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
}
@ -5978,15 +5976,14 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device,
* Some games like Sacrifice set palette after Load, and it is a waste of effort to try to load texture without palette and generates
* warnings in wined3d. */
if (!palette_missing)
hr = IWineD3DDevice_UpdateSurface(device->wineD3DDevice, src_level->WineD3DSurface, &rect, dest_level->WineD3DSurface,
&point);
hr = IWineD3DDevice_UpdateSurface(device->wineD3DDevice, src_level->wined3d_surface,
&rect, dest_level->wined3d_surface, &point);
if (palette_missing || FAILED(hr))
{
/* UpdateSurface may fail e.g. if dest is in system memory. Fall back to BltFast that is less strict. */
IWineD3DSurface_BltFast(dest_level->WineD3DSurface,
point.x, point.y,
src_level->WineD3DSurface, &rect, 0);
wined3d_surface_bltfast(dest_level->wined3d_surface, point.x, point.y,
src_level->wined3d_surface, &rect, 0);
}
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
@ -6778,9 +6775,8 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This)
}
dsi = (IDirectDrawSurfaceImpl *)depthStencil;
TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->WineD3DSurface);
IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice,
dsi->WineD3DSurface);
TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->wined3d_surface);
IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice, dsi->wined3d_surface);
IDirectDrawSurface7_Release(depthStencil);
return WINED3DZB_TRUE;
@ -6827,7 +6823,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
IWineD3DDevice_AddRef(ddraw->wineD3DDevice);
/* Render to the back buffer */
hr = IWineD3DDevice_SetRenderTarget(ddraw->wineD3DDevice, 0, target->WineD3DSurface, TRUE);
hr = IWineD3DDevice_SetRenderTarget(ddraw->wineD3DDevice, 0, target->wined3d_surface, TRUE);
if (FAILED(hr))
{
ERR("Failed to set render target, hr %#x.\n", hr);

View File

@ -183,8 +183,8 @@ static ULONG WINAPI ddraw_surface7_AddRef(IDirectDrawSurface7 *iface)
if (refCount == 1)
{
EnterCriticalSection(&ddraw_cs);
if (This->WineD3DSurface)
IWineD3DSurface_AddRef(This->WineD3DSurface);
if (This->wined3d_surface)
wined3d_surface_incref(This->wined3d_surface);
if (This->wined3d_texture)
wined3d_texture_incref(This->wined3d_texture);
LeaveCriticalSection(&ddraw_cs);
@ -247,8 +247,8 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This)
WARN("(%p): Destroying surface with refount %d\n", This, This->ref);
}
if (This->WineD3DSurface)
IWineD3DSurface_Release(This->WineD3DSurface);
if (This->wined3d_surface)
wined3d_surface_decref(This->wined3d_surface);
}
static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
@ -633,7 +633,7 @@ static HRESULT WINAPI ddraw_surface7_Lock(IDirectDrawSurface7 *iface,
}
}
hr = IWineD3DSurface_Map(This->WineD3DSurface, &LockedRect, Rect, Flags);
hr = wined3d_surface_map(This->wined3d_surface, &LockedRect, Rect, Flags);
if (FAILED(hr))
{
LeaveCriticalSection(&ddraw_cs);
@ -695,7 +695,7 @@ static HRESULT WINAPI ddraw_surface7_Unlock(IDirectDrawSurface7 *iface, RECT *pR
TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(pRect));
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_Unmap(This->WineD3DSurface);
hr = wined3d_surface_unmap(This->wined3d_surface);
if (SUCCEEDED(hr))
{
This->surface_desc.lpSurface = NULL;
@ -768,9 +768,7 @@ static HRESULT WINAPI ddraw_surface7_Flip(IDirectDrawSurface7 *iface, IDirectDra
ddraw_surface7_Release(Override7);
}
hr = IWineD3DSurface_Flip(This->WineD3DSurface,
Override->WineD3DSurface,
Flags);
hr = wined3d_surface_flip(This->wined3d_surface, Override->wined3d_surface, Flags);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -854,11 +852,11 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR
return DDERR_INVALIDPARAMS;
}
/* TODO: Check if the DDBltFx contains any ddraw surface pointers. If it does, copy the struct,
* and replace the ddraw surfaces with the wined3d surfaces
* So far no blitting operations using surfaces in the bltfx struct are supported anyway.
*/
hr = IWineD3DSurface_Blt(This->WineD3DSurface, DestRect, Src ? Src->WineD3DSurface : NULL,
/* TODO: Check if the DDBltFx contains any ddraw surface pointers. If it
* does, copy the struct, and replace the ddraw surfaces with the wined3d
* surfaces. So far no blitting operations using surfaces in the bltfx
* struct are supported anyway. */
hr = wined3d_surface_blt(This->wined3d_surface, DestRect, Src ? Src->wined3d_surface : NULL,
SrcRect, Flags, (WINEDDBLTFX *)DDBltFx, WINED3DTEXF_LINEAR);
LeaveCriticalSection(&ddraw_cs);
@ -1145,8 +1143,7 @@ static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *hdc)
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetDC(This->WineD3DSurface,
hdc);
hr = wined3d_surface_getdc(This->wined3d_surface, hdc);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -1189,7 +1186,7 @@ static HRESULT WINAPI ddraw_surface7_ReleaseDC(IDirectDrawSurface7 *iface, HDC h
TRACE("iface %p, dc %p.\n", iface, hdc);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_ReleaseDC(This->WineD3DSurface, hdc);
hr = wined3d_surface_releasedc(This->wined3d_surface, hdc);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -1262,7 +1259,7 @@ static HRESULT WINAPI ddraw_surface7_SetPriority(IDirectDrawSurface7 *iface, DWO
TRACE("iface %p, priority %u.\n", iface, Priority);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_SetPriority(This->WineD3DSurface, Priority);
hr = wined3d_surface_set_priority(This->wined3d_surface, Priority);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -1293,7 +1290,7 @@ static HRESULT WINAPI ddraw_surface7_GetPriority(IDirectDrawSurface7 *iface, DWO
}
EnterCriticalSection(&ddraw_cs);
*Priority = IWineD3DSurface_GetPriority(This->WineD3DSurface);
*Priority = wined3d_surface_get_priority(This->wined3d_surface);
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}
@ -1325,11 +1322,7 @@ static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface,
iface, debugstr_guid(tag), Data, Size, Flags);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_SetPrivateData(This->WineD3DSurface,
tag,
Data,
Size,
Flags);
hr = wined3d_surface_set_private_data(This->wined3d_surface, tag, Data, Size, Flags);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -1366,10 +1359,7 @@ static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface,
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetPrivateData(This->WineD3DSurface,
tag,
Data,
Size);
hr = wined3d_surface_get_private_data(This->wined3d_surface, tag, Data, Size);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -1395,7 +1385,7 @@ static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface,
TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag));
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_FreePrivateData(This->WineD3DSurface, tag);
hr = wined3d_surface_free_private_data(This->wined3d_surface, tag);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -1626,7 +1616,7 @@ static HRESULT WINAPI ddraw_surface7_GetBltStatus(IDirectDrawSurface7 *iface, DW
TRACE("iface %p, flags %#x.\n", iface, Flags);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetBltStatus(This->WineD3DSurface, Flags);
hr = wined3d_surface_get_blt_status(This->wined3d_surface, Flags);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -1741,7 +1731,7 @@ static HRESULT WINAPI ddraw_surface7_GetFlipStatus(IDirectDrawSurface7 *iface, D
TRACE("iface %p, flags %#x.\n", iface, Flags);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetFlipStatus(This->WineD3DSurface, Flags);
hr = wined3d_surface_get_flip_status(This->wined3d_surface, Flags);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -1777,9 +1767,7 @@ static HRESULT WINAPI ddraw_surface7_GetOverlayPosition(IDirectDrawSurface7 *ifa
TRACE("iface %p, x %p, y %p.\n", iface, X, Y);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetOverlayPosition(This->WineD3DSurface,
X,
Y);
hr = wined3d_surface_get_overlay_position(This->wined3d_surface, X, Y);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -1975,7 +1963,7 @@ static HRESULT WINAPI ddraw_surface7_IsLost(IDirectDrawSurface7 *iface)
return DDERR_SURFACELOST;
}
hr = IWineD3DSurface_IsLost(This->WineD3DSurface);
hr = wined3d_surface_is_lost(This->wined3d_surface);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -2019,7 +2007,7 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
IDirectDrawSurface_AddRef(iface);
ddraw_recreate_surfaces_cb(iface, &This->surface_desc, NULL /* Not needed */);
}
hr = IWineD3DSurface_Restore(This->WineD3DSurface);
hr = wined3d_surface_restore(This->wined3d_surface);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -2051,9 +2039,7 @@ static HRESULT WINAPI ddraw_surface7_SetOverlayPosition(IDirectDrawSurface7 *ifa
TRACE("iface %p, x %d, y %d.\n", iface, X, Y);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_SetOverlayPosition(This->WineD3DSurface,
X,
Y);
hr = wined3d_surface_set_overlay_position(This->wined3d_surface, X, Y);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -2091,12 +2077,8 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, R
iface, wine_dbgstr_rect(SrcRect), DstSurface, wine_dbgstr_rect(DstRect), Flags, FX);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_UpdateOverlay(This->WineD3DSurface,
SrcRect,
Dst ? Dst->WineD3DSurface : NULL,
DstRect,
Flags,
(WINEDDOVERLAYFX *) FX);
hr = wined3d_surface_update_overlay(This->wined3d_surface, SrcRect,
Dst ? Dst->wined3d_surface : NULL, DstRect, Flags, (WINEDDOVERLAYFX *)FX);
LeaveCriticalSection(&ddraw_cs);
switch(hr) {
case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS;
@ -2165,9 +2147,8 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder(IDirectDrawSurface7 *if
TRACE("iface %p, flags %#x, reference %p.\n", iface, Flags, DDSRef);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_UpdateOverlayZOrder(This->WineD3DSurface,
Flags,
Ref ? Ref->WineD3DSurface : NULL);
hr = wined3d_surface_update_overlay_z_order(This->wined3d_surface,
Flags, Ref ? Ref->wined3d_surface : NULL);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@ -2413,11 +2394,8 @@ static HRESULT WINAPI ddraw_surface7_BltFast(IDirectDrawSurface7 *iface, DWORD d
}
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_BltFast(This->WineD3DSurface,
dstx, dsty,
src ? src->WineD3DSurface : NULL,
rsrc,
trans);
hr = wined3d_surface_bltfast(This->wined3d_surface, dstx, dsty,
src ? src->wined3d_surface : NULL, rsrc, trans);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
@ -2519,7 +2497,8 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir
if(oldClipper)
IDirectDrawClipper_Release((IDirectDrawClipper *)oldClipper);
hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL);
hr = wined3d_surface_set_clipper(This->wined3d_surface,
This->clipper ? This->clipper->wineD3DClipper : NULL);
if (This->wined3d_swapchain)
{
@ -2585,9 +2564,8 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
}
if(newFormat != PixelFormat_DD2WineD3D(&This->surface_desc.u4.ddpfPixelFormat) )
{
hr = IWineD3DSurface_SetFormat(This->WineD3DSurface,
newFormat);
if(hr != DD_OK)
hr = wined3d_surface_set_format(This->wined3d_surface, newFormat);
if (FAILED(hr))
{
LeaveCriticalSection(&ddraw_cs);
return hr;
@ -2596,32 +2574,28 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
}
if (DDSD->dwFlags & DDSD_CKDESTOVERLAY)
{
IWineD3DSurface_SetColorKey(This->WineD3DSurface,
DDCKEY_DESTOVERLAY,
(WINEDDCOLORKEY *) &DDSD->u3.ddckCKDestOverlay);
wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_DESTOVERLAY,
(WINEDDCOLORKEY *)&DDSD->u3.ddckCKDestOverlay);
}
if (DDSD->dwFlags & DDSD_CKDESTBLT)
{
IWineD3DSurface_SetColorKey(This->WineD3DSurface,
DDCKEY_DESTBLT,
(WINEDDCOLORKEY *) &DDSD->ddckCKDestBlt);
wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_DESTBLT,
(WINEDDCOLORKEY *)&DDSD->ddckCKDestBlt);
}
if (DDSD->dwFlags & DDSD_CKSRCOVERLAY)
{
IWineD3DSurface_SetColorKey(This->WineD3DSurface,
DDCKEY_SRCOVERLAY,
(WINEDDCOLORKEY *) &DDSD->ddckCKSrcOverlay);
wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_SRCOVERLAY,
(WINEDDCOLORKEY *)&DDSD->ddckCKSrcOverlay);
}
if (DDSD->dwFlags & DDSD_CKSRCBLT)
{
IWineD3DSurface_SetColorKey(This->WineD3DSurface,
DDCKEY_SRCBLT,
(WINEDDCOLORKEY *) &DDSD->ddckCKSrcBlt);
wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_SRCBLT,
(WINEDDCOLORKEY *)&DDSD->ddckCKSrcBlt);
}
if (DDSD->dwFlags & DDSD_LPSURFACE && DDSD->lpSurface)
{
hr = IWineD3DSurface_SetMem(This->WineD3DSurface, DDSD->lpSurface);
if(hr != WINED3D_OK)
hr = wined3d_surface_set_mem(This->wined3d_surface, DDSD->lpSurface);
if (FAILED(hr))
{
/* No need for a trace here, wined3d does that for us */
switch(hr)
@ -2668,7 +2642,7 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
{
IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
struct wined3d_palette *wined3d_palette;
HRESULT hr;
HRESULT hr = DD_OK;
TRACE("iface %p, palette %p.\n", iface, Pal);
@ -2676,13 +2650,7 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DSurface_GetPalette(This->WineD3DSurface, &wined3d_palette);
if (FAILED(hr))
{
LeaveCriticalSection(&ddraw_cs);
return hr;
}
wined3d_palette = wined3d_surface_get_palette(This->wined3d_surface);
if (wined3d_palette)
{
*Pal = wined3d_palette_get_parent(wined3d_palette);
@ -2728,10 +2696,8 @@ SetColorKeyEnum(IDirectDrawSurface7 *surface,
struct SCKContext *ctx = context;
HRESULT hr;
hr = IWineD3DSurface_SetColorKey(This->WineD3DSurface,
ctx->Flags,
ctx->CKey);
if(hr != DD_OK)
hr = wined3d_surface_set_color_key(This->wined3d_surface, ctx->Flags, ctx->CKey);
if (FAILED(hr))
{
WARN("IWineD3DSurface_SetColorKey failed, hr = %08x\n", hr);
ctx->ret = hr;
@ -2827,7 +2793,7 @@ static HRESULT WINAPI ddraw_surface7_SetColorKey(IDirectDrawSurface7 *iface, DWO
return DDERR_INVALIDPARAMS;
}
}
ctx.ret = IWineD3DSurface_SetColorKey(This->WineD3DSurface, Flags, ctx.CKey);
ctx.ret = wined3d_surface_set_color_key(This->wined3d_surface, Flags, ctx.CKey);
ddraw_surface7_EnumAttachedSurfaces(iface, &ctx, SetColorKeyEnum);
LeaveCriticalSection(&ddraw_cs);
switch(ctx.ret)
@ -2882,8 +2848,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
if(oldPal) IDirectDrawPalette_Release(oldPal); /* For the GetPalette */
/* Set the new Palette */
IWineD3DSurface_SetPalette(This->WineD3DSurface,
PalImpl ? PalImpl->wineD3DPalette : NULL);
wined3d_surface_set_palette(This->wined3d_surface, PalImpl ? PalImpl->wineD3DPalette : NULL);
/* AddRef the Palette */
if(Pal) IDirectDrawPalette_AddRef(Pal);
@ -3188,23 +3153,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
/* Get the palettes */
hr = IWineD3DSurface_GetPalette(dst_surface->WineD3DSurface, &wined3d_dst_pal);
if (FAILED(hr))
{
ERR("Failed to get destination palette, hr %#x.\n", hr);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
wined3d_dst_pal = wined3d_surface_get_palette(dst_surface->wined3d_surface);
if (wined3d_dst_pal)
dst_pal = wined3d_palette_get_parent(wined3d_dst_pal);
hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal);
if (FAILED(hr))
{
ERR("Failed to get source palette, hr %#x.\n", hr);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
wined3d_src_pal = wined3d_surface_get_palette(src_surface->wined3d_surface);
if (wined3d_src_pal)
src_pal = wined3d_palette_get_parent(wined3d_src_pal);
@ -3247,7 +3200,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
/* Copy the main memory texture into the surface that corresponds
* to the OpenGL texture object. */
hr = IWineD3DSurface_Map(src_surface->WineD3DSurface, &src_rect, NULL, 0);
hr = wined3d_surface_map(src_surface->wined3d_surface, &src_rect, NULL, 0);
if (FAILED(hr))
{
ERR("Failed to lock source surface, hr %#x.\n", hr);
@ -3255,11 +3208,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
return D3DERR_TEXTURE_LOAD_FAILED;
}
hr = IWineD3DSurface_Map(dst_surface->WineD3DSurface, &dst_rect, NULL, 0);
hr = wined3d_surface_map(dst_surface->wined3d_surface, &dst_rect, NULL, 0);
if (FAILED(hr))
{
ERR("Failed to lock destination surface, hr %#x.\n", hr);
IWineD3DSurface_Unmap(src_surface->WineD3DSurface);
wined3d_surface_unmap(src_surface->wined3d_surface);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
@ -3269,8 +3222,8 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
else
memcpy(dst_rect.pBits, src_rect.pBits, src_rect.Pitch * src_desc->dwHeight);
IWineD3DSurface_Unmap(src_surface->WineD3DSurface);
IWineD3DSurface_Unmap(dst_surface->WineD3DSurface);
wined3d_surface_unmap(src_surface->wined3d_surface);
wined3d_surface_unmap(dst_surface->wined3d_surface);
}
if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
@ -3622,7 +3575,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format,
TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool,
WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface,
&ddraw_surface_wined3d_parent_ops, &surface->WineD3DSurface);
&ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface);
if (FAILED(hr))
{
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
@ -3630,7 +3583,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
}
surface->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
wined3d_resource = IWineD3DSurface_GetResource(surface->WineD3DSurface);
wined3d_resource = wined3d_surface_get_resource(surface->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
format = wined3d_desc.format;
@ -3658,36 +3611,36 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
else
{
surface->surface_desc.dwFlags |= DDSD_PITCH;
surface->surface_desc.u1.lPitch = IWineD3DSurface_GetPitch(surface->WineD3DSurface);
surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(surface->wined3d_surface);
}
if (desc->dwFlags & DDSD_CKDESTOVERLAY)
{
IWineD3DSurface_SetColorKey(surface->WineD3DSurface,
DDCKEY_DESTOVERLAY, (WINEDDCOLORKEY *)&desc->u3.ddckCKDestOverlay);
wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTOVERLAY,
(WINEDDCOLORKEY *)&desc->u3.ddckCKDestOverlay);
}
if (desc->dwFlags & DDSD_CKDESTBLT)
{
IWineD3DSurface_SetColorKey(surface->WineD3DSurface,
DDCKEY_DESTBLT, (WINEDDCOLORKEY *)&desc->ddckCKDestBlt);
wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTBLT,
(WINEDDCOLORKEY *)&desc->ddckCKDestBlt);
}
if (desc->dwFlags & DDSD_CKSRCOVERLAY)
{
IWineD3DSurface_SetColorKey(surface->WineD3DSurface,
DDCKEY_SRCOVERLAY, (WINEDDCOLORKEY *)&desc->ddckCKSrcOverlay);
wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCOVERLAY,
(WINEDDCOLORKEY *)&desc->ddckCKSrcOverlay);
}
if (desc->dwFlags & DDSD_CKSRCBLT)
{
IWineD3DSurface_SetColorKey(surface->WineD3DSurface,
DDCKEY_SRCBLT, (WINEDDCOLORKEY *)&desc->ddckCKSrcBlt);
wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCBLT,
(WINEDDCOLORKEY *)&desc->ddckCKSrcBlt);
}
if (desc->dwFlags & DDSD_LPSURFACE)
{
hr = IWineD3DSurface_SetMem(surface->WineD3DSurface, desc->lpSurface);
hr = wined3d_surface_set_mem(surface->wined3d_surface, desc->lpSurface);
if (FAILED(hr))
{
ERR("Failed to set surface memory, hr %#x.\n", hr);
IWineD3DSurface_Release(surface->WineD3DSurface);
wined3d_surface_decref(surface->wined3d_surface);
return hr;
}
}

View File

@ -178,7 +178,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
memset(surface, 0, surface_count * sizeof(*surface));
for (i = 0; i < surface_count; ++i)
{
IWineD3DSurface *wined3d_surface;
struct wined3d_surface *wined3d_surface;
IUnknown *parent;
hr = IWineD3DDeviceParent_CreateSurface(device_parent, NULL, desc->Width, desc->Height,
@ -190,9 +190,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
goto fail;
}
parent = IWineD3DSurface_GetParent(wined3d_surface);
parent = wined3d_surface_get_parent(wined3d_surface);
hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]);
IWineD3DSurface_Release(wined3d_surface);
wined3d_surface_decref(wined3d_surface);
if (FAILED(hr))
{
ERR("Surface should implement IDXGISurface\n");

View File

@ -144,7 +144,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
UINT buffer_idx, REFIID riid, void **surface)
{
struct dxgi_swapchain *This = (struct dxgi_swapchain *)iface;
IWineD3DSurface *backbuffer;
struct wined3d_surface *backbuffer;
IUnknown *parent;
HRESULT hr;
@ -161,9 +161,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
return hr;
}
parent = IWineD3DSurface_GetParent(backbuffer);
parent = wined3d_surface_get_parent(backbuffer);
hr = IUnknown_QueryInterface(parent, riid, surface);
IWineD3DSurface_Release(backbuffer);
wined3d_surface_decref(backbuffer);
LeaveCriticalSection(&dxgi_cs);
return hr;

View File

@ -582,10 +582,10 @@ void device_switch_onscreen_ds(IWineD3DDeviceImpl *device,
surface_modify_ds_location(device->onscreen_depth_stencil, SFLAG_DS_OFFSCREEN,
device->onscreen_depth_stencil->ds_current_size.cx,
device->onscreen_depth_stencil->ds_current_size.cy);
IWineD3DSurface_Release((IWineD3DSurface *)device->onscreen_depth_stencil);
wined3d_surface_decref(device->onscreen_depth_stencil);
}
device->onscreen_depth_stencil = depth_stencil;
IWineD3DSurface_AddRef((IWineD3DSurface *)device->onscreen_depth_stencil);
wined3d_surface_incref(device->onscreen_depth_stencil);
}
static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, const RECT *clear_rect)
@ -1692,15 +1692,16 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
goto out;
}
if(dcb) {
hr = IWineD3DSurface_GetDC(This->logo_surface, &dcs);
if(FAILED(hr)) goto out;
if (dcb)
{
if (FAILED(hr = wined3d_surface_getdc(This->logo_surface, &dcs)))
goto out;
BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY);
IWineD3DSurface_ReleaseDC(This->logo_surface, dcs);
wined3d_surface_releasedc(This->logo_surface, dcs);
colorkey.dwColorSpaceLowValue = 0;
colorkey.dwColorSpaceHighValue = 0;
IWineD3DSurface_SetColorKey(This->logo_surface, WINEDDCKEY_SRCBLT, &colorkey);
wined3d_surface_set_color_key(This->logo_surface, WINEDDCKEY_SRCBLT, &colorkey);
}
else
{
@ -1983,12 +1984,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
TRACE("Setting rendertarget to %p.\n", swapchain->front_buffer);
This->render_targets[0] = swapchain->front_buffer;
}
IWineD3DSurface_AddRef((IWineD3DSurface *)This->render_targets[0]);
wined3d_surface_incref(This->render_targets[0]);
/* Depth Stencil support */
This->depth_stencil = This->auto_depth_stencil;
if (This->depth_stencil)
IWineD3DSurface_AddRef((IWineD3DSurface *)This->depth_stencil);
wined3d_surface_incref(This->depth_stencil);
hr = This->shader_backend->shader_alloc_private(This);
if(FAILED(hr)) {
@ -2134,8 +2135,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
const struct wined3d_gl_info *gl_info;
struct IWineD3DSurfaceImpl *surface;
struct wined3d_context *context;
struct wined3d_surface *surface;
UINT i;
TRACE("(%p)\n", This);
@ -2150,7 +2151,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
context = context_acquire(This, NULL);
gl_info = context->gl_info;
if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface);
if (This->logo_surface)
wined3d_surface_decref(This->logo_surface);
/* Unload resources */
IWineD3DDevice_EnumResources(iface, device_unload_resource, NULL);
@ -2218,7 +2220,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
{
surface = This->onscreen_depth_stencil;
This->onscreen_depth_stencil = NULL;
IWineD3DSurface_Release((IWineD3DSurface *)surface);
wined3d_surface_decref(surface);
}
if (This->depth_stencil)
@ -2228,7 +2230,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
TRACE("Releasing depth/stencil buffer %p.\n", surface);
This->depth_stencil = NULL;
if (IWineD3DSurface_Release((IWineD3DSurface *)surface)
if (wined3d_surface_decref(surface)
&& surface != This->auto_depth_stencil)
{
ERR("Something is still holding a reference to depth/stencil buffer %p.\n", surface);
@ -2239,7 +2241,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
{
surface = This->auto_depth_stencil;
This->auto_depth_stencil = NULL;
if (IWineD3DSurface_Release((IWineD3DSurface *)surface))
if (wined3d_surface_decref(surface))
{
FIXME("(%p) Something's still holding the auto depth stencil buffer\n", This);
}
@ -2254,7 +2256,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
TRACE("Setting rendertarget 0 to NULL\n");
This->render_targets[0] = NULL;
TRACE("Releasing the render target at %p\n", surface);
IWineD3DSurface_Release((IWineD3DSurface *)surface);
wined3d_surface_decref(surface);
context_release(context);
@ -5548,7 +5550,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
* loading. */
d3dfmt_get_conv(dst_impl, FALSE, TRUE, &format, &convert);
if (convert != NO_CONVERSION || format.convert)
return IWineD3DSurface_BltFast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0);
return wined3d_surface_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0);
context = context_acquire(This, NULL);
gl_info = context->gl_info;
@ -5815,7 +5817,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
}
*render_target = (IWineD3DSurface *)device->render_targets[render_target_idx];
if (*render_target) IWineD3DSurface_AddRef(*render_target);
if (*render_target)
wined3d_surface_incref(*render_target);
TRACE("Returning render target %p.\n", *render_target);
@ -5831,7 +5834,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *
*depth_stencil = (IWineD3DSurface *)device->depth_stencil;
TRACE("Returning depth/stencil surface %p.\n", *depth_stencil);
if (!*depth_stencil) return WINED3DERR_NOTFOUND;
IWineD3DSurface_AddRef(*depth_stencil);
wined3d_surface_incref(*depth_stencil);
return WINED3D_OK;
}
@ -5871,11 +5874,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
return WINED3DERR_INVALIDCALL;
}
if (render_target) IWineD3DSurface_AddRef(render_target);
if (render_target)
wined3d_surface_incref(render_target);
device->render_targets[render_target_idx] = (IWineD3DSurfaceImpl *)render_target;
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
if (prev) IWineD3DSurface_Release((IWineD3DSurface *)prev);
if (prev)
wined3d_surface_decref(prev);
/* Render target 0 is special. */
if (!render_target_idx && set_viewport)
@ -5924,7 +5929,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
This->depth_stencil->resource.height);
if (This->depth_stencil == This->onscreen_depth_stencil)
{
IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil);
wined3d_surface_decref(This->onscreen_depth_stencil);
This->onscreen_depth_stencil = NULL;
}
}
@ -5932,8 +5937,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
tmp = This->depth_stencil;
This->depth_stencil = (IWineD3DSurfaceImpl *)depth_stencil;
if (This->depth_stencil) IWineD3DSurface_AddRef((IWineD3DSurface *)This->depth_stencil);
if (tmp) IWineD3DSurface_Release((IWineD3DSurface *)tmp);
if (This->depth_stencil)
wined3d_surface_incref(This->depth_stencil);
if (tmp)
wined3d_surface_decref(tmp);
if ((!tmp && depth_stencil) || (!depth_stencil && tmp))
{
@ -6008,7 +6015,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
*/
This->cursorWidth = s->resource.width;
This->cursorHeight = s->resource.height;
if (SUCCEEDED(IWineD3DSurface_Map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
if (SUCCEEDED(wined3d_surface_map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
@ -6028,7 +6035,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
for(i = 0; i < height; i++)
memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp);
IWineD3DSurface_Unmap(cursor_image);
wined3d_surface_unmap(cursor_image);
context = context_acquire(This, NULL);
@ -6084,7 +6091,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* chunks. */
DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
(s->resource.width * s->resource.height / 8));
IWineD3DSurface_Map(cursor_image, &lockedRect, NULL,
wined3d_surface_map(cursor_image, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
TRACE("width: %u height: %u.\n", s->resource.width, s->resource.height);
@ -6093,7 +6100,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
cursorInfo.yHotspot = YHotSpot;
cursorInfo.hbmMask = CreateBitmap(s->resource.width, s->resource.height, 1, 1, maskBits);
cursorInfo.hbmColor = CreateBitmap(s->resource.width, s->resource.height, 1, 32, lockedRect.pBits);
IWineD3DSurface_Unmap(cursor_image);
wined3d_surface_unmap(cursor_image);
/* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo);
SetCursor(cursor);
@ -6230,7 +6237,7 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES
HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory);
surface->resource.allocatedMemory = NULL;
surface->resource.heapMemory = NULL;
surface->resource.size = IWineD3DSurface_GetPitch((IWineD3DSurface *) surface) * surface->pow2Width;
surface->resource.size = wined3d_surface_get_pitch(surface) * surface->pow2Width;
/* Put all surfaces into sysmem - the drawable might disappear if the backbuffer was rendered
* to a FBO */
@ -6470,7 +6477,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
if (This->onscreen_depth_stencil)
{
IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil);
wined3d_surface_decref(This->onscreen_depth_stencil);
This->onscreen_depth_stencil = NULL;
}

View File

@ -1303,8 +1303,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
{
struct wined3d_resource_desc desc;
wined3d_resource_get_desc(&((IWineD3DSurfaceImpl *)backbuffer)->resource, &desc);
IWineD3DSurface_Release(backbuffer);
wined3d_resource_get_desc(&backbuffer->resource, &desc);
wined3d_surface_decref(backbuffer);
/* Set the default scissor rect values */
state->scissor_rect.left = 0;

View File

@ -94,7 +94,8 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
This->resource.allocatedMemory = NULL;
}
if (This->flags & SFLAG_USERPTR) IWineD3DSurface_SetMem((IWineD3DSurface *)This, NULL);
if (This->flags & SFLAG_USERPTR)
wined3d_surface_set_mem(This, NULL);
if (This->overlay_dest) list_remove(&This->overlay_entry);
HeapFree(GetProcessHeap(), 0, This->palette9);
@ -397,10 +398,10 @@ static HRESULT surface_create_dib_section(IWineD3DSurfaceImpl *surface)
b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
/* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */
b_info->bmiHeader.biWidth = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface) / format->byte_count;
b_info->bmiHeader.biWidth = wined3d_surface_get_pitch(surface) / format->byte_count;
b_info->bmiHeader.biHeight = -surface->resource.height - extraline;
b_info->bmiHeader.biSizeImage = (surface->resource.height + extraline)
* IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
* wined3d_surface_get_pitch(surface);
b_info->bmiHeader.biPlanes = 1;
b_info->bmiHeader.biBitCount = format->byte_count * 8;
@ -468,7 +469,7 @@ static HRESULT surface_create_dib_section(IWineD3DSurfaceImpl *surface)
if (surface->resource.allocatedMemory)
{
memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory,
surface->resource.height * IWineD3DSurface_GetPitch((IWineD3DSurface *)surface));
surface->resource.height * wined3d_surface_get_pitch(surface));
}
else
{
@ -646,7 +647,7 @@ static void surface_release_client_storage(IWineD3DSurfaceImpl *surface)
surface_force_reload(surface);
}
static HRESULT surface_private_setup(struct IWineD3DSurfaceImpl *surface)
static HRESULT surface_private_setup(struct wined3d_surface *surface)
{
/* TODO: Check against the maximum texture sizes supported by the video card. */
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
@ -822,9 +823,8 @@ static HRESULT surface_draw_overlay(IWineD3DSurfaceImpl *surface)
return WINED3D_OK;
surface->overlay_dest->flags |= SFLAG_INOVERLAYDRAW;
hr = IWineD3DSurface_Blt((IWineD3DSurface *)surface->overlay_dest,
&surface->overlay_destrect, (IWineD3DSurface *)surface, &surface->overlay_srcrect,
WINEDDBLT_WAIT, NULL, WINED3DTEXF_LINEAR);
hr = wined3d_surface_blt(surface->overlay_dest, &surface->overlay_destrect, surface,
&surface->overlay_srcrect, WINEDDBLT_WAIT, NULL, WINED3DTEXF_LINEAR);
surface->overlay_dest->flags &= ~SFLAG_INOVERLAYDRAW;
return hr;
@ -1034,7 +1034,7 @@ static HRESULT surface_getdc(IWineD3DSurfaceImpl *surface)
}
/* Map the surface. */
hr = IWineD3DSurface_Map((IWineD3DSurface *)surface, &lock, NULL, 0);
hr = wined3d_surface_map(surface, &lock, NULL, 0);
if (FAILED(hr))
ERR("Map failed, hr %#x.\n", hr);
@ -1680,7 +1680,7 @@ static void surface_gdi_cleanup(IWineD3DSurfaceImpl *surface)
}
if (surface->flags & SFLAG_USERPTR)
IWineD3DSurface_SetMem((IWineD3DSurface *)surface, NULL);
wined3d_surface_set_mem(surface, NULL);
if (surface->overlay_dest)
list_remove(&surface->overlay_entry);
@ -1786,7 +1786,7 @@ static HRESULT gdi_surface_getdc(IWineD3DSurfaceImpl *surface)
}
/* Map the surface. */
hr = IWineD3DSurface_Map((IWineD3DSurface *)surface, &lock, NULL, 0);
hr = wined3d_surface_map(surface, &lock, NULL, 0);
if (FAILED(hr))
ERR("Map failed, hr %#x.\n", hr);
@ -2054,7 +2054,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
{
unsigned char alignment = This->resource.device->surface_alignment;
src_pitch = format->byte_count * This->pow2Width;
dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);
dst_pitch = wined3d_surface_get_pitch(This);
src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1);
mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * This->pow2Height);
} else {
@ -2606,28 +2606,8 @@ static inline unsigned short float_32_to_16(const float *in)
return ret;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface,
REFIID riid, void **object)
ULONG CDECL wined3d_surface_incref(struct wined3d_surface *surface)
{
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_IWineD3DSurface)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
ULONG refcount;
TRACE("Surface %p, container %p of type %#x.\n",
@ -2654,9 +2634,8 @@ static ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface)
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DBaseSurfaceImpl_Release(IWineD3DSurface *iface)
ULONG CDECL wined3d_surface_decref(struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
ULONG refcount;
TRACE("Surface %p, container %p of type %#x.\n",
@ -2692,59 +2671,57 @@ static ULONG WINAPI IWineD3DBaseSurfaceImpl_Release(IWineD3DSurface *iface)
return refcount;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface,
HRESULT CDECL wined3d_surface_set_private_data(struct wined3d_surface *surface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags)
{
return resource_set_private_data(&((IWineD3DSurfaceImpl *)iface)->resource, riid, data, data_size, flags);
return resource_set_private_data(&surface->resource, riid, data, data_size, flags);
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface,
HRESULT CDECL wined3d_surface_get_private_data(const struct wined3d_surface *surface,
REFGUID guid, void *data, DWORD *data_size)
{
return resource_get_private_data(&((IWineD3DSurfaceImpl *)iface)->resource, guid, data, data_size);
return resource_get_private_data(&surface->resource, guid, data, data_size);
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid)
HRESULT CDECL wined3d_surface_free_private_data(struct wined3d_surface *surface, REFGUID refguid)
{
return resource_free_private_data(&((IWineD3DSurfaceImpl *)iface)->resource, refguid);
return resource_free_private_data(&surface->resource, refguid);
}
static DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD priority)
DWORD CDECL wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD priority)
{
return resource_set_priority(&((IWineD3DSurfaceImpl *)iface)->resource, priority);
return resource_set_priority(&surface->resource, priority);
}
static DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface)
DWORD CDECL wined3d_surface_get_priority(const struct wined3d_surface *surface)
{
return resource_get_priority(&((IWineD3DSurfaceImpl *)iface)->resource);
return resource_get_priority(&surface->resource);
}
static void WINAPI IWineD3DBaseSurfaceImpl_PreLoad(IWineD3DSurface *iface)
void CDECL wined3d_surface_preload(struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
surface->surface_ops->surface_preload(surface);
}
static void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface)
{
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
return ((IWineD3DSurfaceImpl *)iface)->resource.parent;
return surface->resource.parent;
}
static struct wined3d_resource * WINAPI IWineD3DBaseSurfaceImpl_GetResource(IWineD3DSurface *iface)
struct wined3d_resource * CDECL wined3d_surface_get_resource(struct wined3d_surface *surface)
{
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
return &((IWineD3DSurfaceImpl *)iface)->resource;
return &surface->resource;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD flags)
HRESULT CDECL wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags)
{
TRACE("iface %p, flags %#x.\n", iface, flags);
TRACE("surface %p, flags %#x.\n", surface, flags);
switch (flags)
{
@ -2757,11 +2734,11 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *ifac
}
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD flags)
HRESULT CDECL wined3d_surface_get_flip_status(const struct wined3d_surface *surface, DWORD flags)
{
/* XXX: DDERR_INVALIDSURFACETYPE */
TRACE("surface %p, flags %#x.\n", surface, flags);
TRACE("iface %p, flags %#x.\n", iface, flags);
/* XXX: DDERR_INVALIDSURFACETYPE */
switch (flags)
{
@ -2774,32 +2751,26 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *ifa
}
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_IsLost(IWineD3DSurface *iface)
HRESULT CDECL wined3d_surface_is_lost(const struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
/* D3D8 and 9 loose full devices, ddraw only surfaces. */
return surface->flags & SFLAG_LOST ? WINED3DERR_DEVICELOST : WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Restore(IWineD3DSurface *iface)
HRESULT CDECL wined3d_surface_restore(struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
/* So far we don't lose anything :) */
surface->flags &= ~SFLAG_LOST;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, struct wined3d_palette *palette)
HRESULT CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, palette %p.\n", iface, palette);
TRACE("surface %p, palette %p.\n", surface, palette);
if (surface->palette == palette)
{
@ -2823,12 +2794,10 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface,
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface,
HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface,
DWORD flags, const WINEDDCOLORKEY *color_key)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, flags %#x, color_key %p.\n", iface, flags, color_key);
TRACE("surface %p, flags %#x, color_key %p.\n", surface, flags, color_key);
if (flags & WINEDDCKEY_COLORSPACE)
{
@ -2887,24 +2856,19 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, struct wined3d_palette **palette)
struct wined3d_palette * CDECL wined3d_surface_get_palette(const struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *) iface;
TRACE("surface %p.\n", surface);
TRACE("iface %p, palette %p.\n", iface, palette);
*palette = surface->palette;
return WINED3D_OK;
return surface->palette;
}
static DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface)
DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
const struct wined3d_format *format = surface->resource.format;
DWORD pitch;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
if ((format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED)
{
@ -2925,11 +2889,9 @@ static DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface)
return pitch;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetMem(IWineD3DSurface *iface, void *mem)
HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, mem %p.\n", iface, mem);
TRACE("surface %p, mem %p.\n", surface, mem);
if (surface->flags & (SFLAG_LOCKED | SFLAG_DCINUSE))
{
@ -2940,12 +2902,11 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetMem(IWineD3DSurface *iface, voi
return surface->surface_ops->surface_set_mem(surface, mem);
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG x, LONG y)
HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
LONG w, h;
TRACE("iface %p, x %d, y %d.\n", iface, x, y);
TRACE("surface %p, x %d, y %d.\n", surface, x, y);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
@ -2965,11 +2926,9 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *x, LONG *y)
HRESULT CDECL wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, x %p, y %p.\n", iface, x, y);
TRACE("surface %p, x %p, y %p.\n", surface, x, y);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
@ -2993,12 +2952,10 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface,
DWORD flags, IWineD3DSurface *ref)
HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
DWORD flags, struct wined3d_surface *ref)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
FIXME("iface %p, flags %#x, ref %p stub!\n", iface, flags, ref);
FIXME("surface %p, flags %#x, ref %p stub!\n", surface, flags, ref);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
@ -3009,14 +2966,13 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurfac
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, const RECT *src_rect,
HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
IWineD3DSurface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Dst = (IWineD3DSurfaceImpl *)dst_surface;
TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
TRACE("surface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
@ -3081,36 +3037,27 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *ifa
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, struct wined3d_clipper *clipper)
HRESULT CDECL wined3d_surface_set_clipper(struct wined3d_surface *surface, struct wined3d_clipper *clipper)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, clipper %p.\n", iface, clipper);
TRACE("surface %p, clipper %p.\n", surface, clipper);
surface->clipper = clipper;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, struct wined3d_clipper **clipper)
struct wined3d_clipper * CDECL wined3d_surface_get_clipper(const struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("surface %p.\n", surface);
TRACE("iface %p, clipper %p.\n", iface, clipper);
*clipper = surface->clipper;
if (*clipper)
wined3d_clipper_incref(*clipper);
return WINED3D_OK;
return surface->clipper;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format_id)
HRESULT CDECL wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
const struct wined3d_format *format = wined3d_get_format(&surface->resource.device->adapter->gl_info, format_id);
TRACE("iface %p, format %s.\n", iface, debug_d3dformat(format_id));
TRACE("surface %p, format %s.\n", surface, debug_d3dformat(format_id));
if (surface->resource.format->id != WINED3DFMT_UNKNOWN)
{
@ -3366,29 +3313,29 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
memset(&lock_src, 0, sizeof(lock_src));
memset(&lock_dst, 0, sizeof(lock_dst));
hr = IWineD3DSurface_Map((IWineD3DSurface *)source, &lock_src, NULL, WINED3DLOCK_READONLY);
hr = wined3d_surface_map(source, &lock_src, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr))
{
ERR("Failed to lock the source surface.\n");
IWineD3DSurface_Release(ret);
wined3d_surface_decref(ret);
return NULL;
}
hr = IWineD3DSurface_Map(ret, &lock_dst, NULL, WINED3DLOCK_READONLY);
hr = wined3d_surface_map(ret, &lock_dst, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr))
{
ERR("Failed to lock the destination surface.\n");
IWineD3DSurface_Unmap((IWineD3DSurface *)source);
IWineD3DSurface_Release(ret);
wined3d_surface_unmap(source);
wined3d_surface_decref(ret);
return NULL;
}
conv->convert(lock_src.pBits, lock_dst.pBits, lock_src.Pitch, lock_dst.Pitch,
source->resource.width, source->resource.height);
IWineD3DSurface_Unmap(ret);
IWineD3DSurface_Unmap((IWineD3DSurface *)source);
wined3d_surface_unmap(ret);
wined3d_surface_unmap(source);
return (IWineD3DSurfaceImpl *)ret;
return ret;
}
static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height,
@ -3450,38 +3397,32 @@ do { \
}
/* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *dst_rect,
IWineD3DSurface *src_surface, const RECT *src_rect, DWORD flags,
HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter)
{
IWineD3DSurfaceImpl *dst_surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
flags, fx, debug_d3dtexturefiltertype(filter));
return dst_surface->surface_ops->surface_blt(dst_surface, dst_rect,
(IWineD3DSurfaceImpl *)src_surface, src_rect, flags, fx, filter);
return dst_surface->surface_ops->surface_blt(dst_surface,
dst_rect, src_surface, src_rect, flags, fx, filter);
}
/* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
DWORD dst_x, DWORD dst_y, IWineD3DSurface *src_surface, const RECT *src_rect, DWORD trans)
HRESULT CDECL wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans)
{
IWineD3DSurfaceImpl *dst_surface = (IWineD3DSurfaceImpl *)iface;
TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, trans %#x.\n",
dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans);
TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, trans %#x.\n",
iface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans);
return dst_surface->surface_ops->surface_bltfast(dst_surface, dst_x, dst_y,
(IWineD3DSurfaceImpl *)src_surface, src_rect, trans);
return dst_surface->surface_ops->surface_bltfast(dst_surface,
dst_x, dst_y, src_surface, src_rect, trans);
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Unmap(IWineD3DSurface *iface)
HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
if (!(surface->flags & SFLAG_LOCKED))
{
@ -3495,13 +3436,11 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Unmap(IWineD3DSurface *iface)
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Map(IWineD3DSurface *iface,
HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, locked_rect %p, rect %s, flags %#x.\n",
iface, locked_rect, wine_dbgstr_rect(rect), flags);
TRACE("surface %p, locked_rect %p, rect %s, flags %#x.\n",
surface, locked_rect, wine_dbgstr_rect(rect), flags);
if (surface->flags & SFLAG_LOCKED)
{
@ -3515,7 +3454,7 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Map(IWineD3DSurface *iface,
surface->surface_ops->surface_map(surface, rect, flags);
locked_rect->Pitch = IWineD3DSurface_GetPitch(iface);
locked_rect->Pitch = wined3d_surface_get_pitch(surface);
if (!rect)
{
@ -3555,12 +3494,11 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Map(IWineD3DSurface *iface,
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *dc)
HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
HRESULT hr;
TRACE("iface %p, dc %p.\n", iface, dc);
TRACE("surface %p, dc %p.\n", surface, dc);
if (surface->flags & SFLAG_USERPTR)
{
@ -3625,11 +3563,9 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC dc)
HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, dc %p.\n", iface, dc);
TRACE("surface %p, dc %p.\n", surface, dc);
if (!(surface->flags & SFLAG_DCINUSE))
return WINEDDERR_NODC;
@ -3648,20 +3584,19 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_ReleaseDC(IWineD3DSurface *iface,
}
/* We locked first, so unlock now. */
IWineD3DSurface_Unmap(iface);
wined3d_surface_unmap(surface);
surface->flags &= ~SFLAG_DCINUSE;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD flags)
HRESULT CDECL wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
struct wined3d_swapchain *swapchain;
HRESULT hr;
TRACE("iface %p, override %p, flags %#x.\n", iface, override, flags);
TRACE("surface %p, override %p, flags %#x.\n", surface, override, flags);
if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN)
{
@ -3670,7 +3605,7 @@ static HRESULT WINAPI IWineD3DBaseSurfaceImpl_Flip(IWineD3DSurface *iface, IWine
}
swapchain = surface->container.u.swapchain;
hr = surface->surface_ops->surface_flip(surface, (IWineD3DSurfaceImpl *)override);
hr = surface->surface_ops->surface_flip(surface, override);
if (FAILED(hr))
return hr;
@ -4109,8 +4044,8 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_
static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *surface,
const RECT *rect, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem)
{
UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface); /* target is argb, 4 byte */
IWineD3DDeviceImpl *device = surface->resource.device;
UINT pitch = wined3d_surface_get_pitch(surface);
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
RECT local_rect;
@ -5996,7 +5931,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
{
/* Note: It might be faster to download into a texture first. */
read_from_framebuffer(surface, rect, surface->resource.allocatedMemory,
IWineD3DSurface_GetPitch((IWineD3DSurface *)surface));
wined3d_surface_get_pitch(surface));
}
}
else if (flag == SFLAG_INDRAWABLE)
@ -6028,7 +5963,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
/* The width is in 'length' not in bytes */
width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
pitch = wined3d_surface_get_pitch(surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED
* but it isn't set (yet) in all cases it is getting called. */
@ -6144,7 +6079,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
/* The width is in 'length' not in bytes */
width = surface->resource.width;
pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface);
pitch = wined3d_surface_get_pitch(surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED
* but it isn't set (yet) in all cases it is getting called. */
@ -6253,48 +6188,6 @@ BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface)
return swapchain->render_to_fbo;
}
const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
{
/* IUnknown */
IWineD3DBaseSurfaceImpl_QueryInterface,
IWineD3DBaseSurfaceImpl_AddRef,
IWineD3DBaseSurfaceImpl_Release,
/* IWineD3DResource */
IWineD3DBaseSurfaceImpl_GetParent,
IWineD3DBaseSurfaceImpl_SetPrivateData,
IWineD3DBaseSurfaceImpl_GetPrivateData,
IWineD3DBaseSurfaceImpl_FreePrivateData,
IWineD3DBaseSurfaceImpl_SetPriority,
IWineD3DBaseSurfaceImpl_GetPriority,
IWineD3DBaseSurfaceImpl_PreLoad,
/* IWineD3DSurface */
IWineD3DBaseSurfaceImpl_GetResource,
IWineD3DBaseSurfaceImpl_Map,
IWineD3DBaseSurfaceImpl_Unmap,
IWineD3DBaseSurfaceImpl_GetDC,
IWineD3DBaseSurfaceImpl_ReleaseDC,
IWineD3DBaseSurfaceImpl_Flip,
IWineD3DBaseSurfaceImpl_Blt,
IWineD3DBaseSurfaceImpl_GetBltStatus,
IWineD3DBaseSurfaceImpl_GetFlipStatus,
IWineD3DBaseSurfaceImpl_IsLost,
IWineD3DBaseSurfaceImpl_Restore,
IWineD3DBaseSurfaceImpl_BltFast,
IWineD3DBaseSurfaceImpl_GetPalette,
IWineD3DBaseSurfaceImpl_SetPalette,
IWineD3DBaseSurfaceImpl_SetColorKey,
IWineD3DBaseSurfaceImpl_GetPitch,
IWineD3DBaseSurfaceImpl_SetMem,
IWineD3DBaseSurfaceImpl_SetOverlayPosition,
IWineD3DBaseSurfaceImpl_GetOverlayPosition,
IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder,
IWineD3DBaseSurfaceImpl_UpdateOverlay,
IWineD3DBaseSurfaceImpl_SetClipper,
IWineD3DBaseSurfaceImpl_GetClipper,
/* Internal use: */
IWineD3DBaseSurfaceImpl_SetFormat,
};
static HRESULT ffp_blit_alloc(IWineD3DDeviceImpl *device) { return WINED3D_OK; }
/* Context activation is done by the caller. */
static void ffp_blit_free(IWineD3DDeviceImpl *device) { }
@ -6636,7 +6529,7 @@ static HRESULT surface_cpu_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst
if (src_surface == dst_surface)
{
IWineD3DSurface_Map((IWineD3DSurface *)dst_surface, &dlock, NULL, 0);
wined3d_surface_map(dst_surface, &dlock, NULL, 0);
slock = dlock;
src_format = dst_surface->resource.format;
dst_format = src_format;
@ -6656,7 +6549,7 @@ static HRESULT surface_cpu_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst
goto release;
}
}
IWineD3DSurface_Map((IWineD3DSurface *)src_surface, &slock, NULL, WINED3DLOCK_READONLY);
wined3d_surface_map(src_surface, &slock, NULL, WINED3DLOCK_READONLY);
src_format = src_surface->resource.format;
}
else
@ -6664,9 +6557,9 @@ static HRESULT surface_cpu_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst
src_format = dst_format;
}
if (dst_rect)
IWineD3DSurface_Map((IWineD3DSurface *)dst_surface, &dlock, &xdst, 0);
wined3d_surface_map(dst_surface, &dlock, &xdst, 0);
else
IWineD3DSurface_Map((IWineD3DSurface *)dst_surface, &dlock, NULL, 0);
wined3d_surface_map(dst_surface, &dlock, NULL, 0);
}
if (!fx || !(fx->dwDDFX)) flags &= ~WINEDDBLT_DDFX;
@ -7095,12 +6988,12 @@ error:
}
release:
IWineD3DSurface_Unmap((IWineD3DSurface *)dst_surface);
wined3d_surface_unmap(dst_surface);
if (src_surface && src_surface != dst_surface)
IWineD3DSurface_Unmap((IWineD3DSurface *)src_surface);
wined3d_surface_unmap(src_surface);
/* Release the converted surface, if any. */
if (src_surface && src_surface != orig_src)
IWineD3DSurface_Release((IWineD3DSurface *)src_surface);
wined3d_surface_decref(src_surface);
return hr;
}
@ -7183,8 +7076,8 @@ static HRESULT surface_cpu_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x
UnionRect(&lock_union, &lock_src, &lock_dst);
/* Lock the union of the two rectangles */
hr = IWineD3DSurface_Map((IWineD3DSurface *)dst_surface, &dlock, &lock_union, 0);
/* Lock the union of the two rectangles. */
hr = wined3d_surface_map(dst_surface, &dlock, &lock_union, 0);
if (FAILED(hr))
goto error;
@ -7199,10 +7092,10 @@ static HRESULT surface_cpu_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x
}
else
{
hr = IWineD3DSurface_Map((IWineD3DSurface *)src_surface, &slock, &lock_src, WINED3DLOCK_READONLY);
hr = wined3d_surface_map(src_surface, &slock, &lock_src, WINED3DLOCK_READONLY);
if (FAILED(hr))
goto error;
hr = IWineD3DSurface_Map((IWineD3DSurface *)dst_surface, &dlock, &lock_dst, 0);
hr = wined3d_surface_map(dst_surface, &dlock, &lock_dst, 0);
if (FAILED(hr))
goto error;
@ -7366,12 +7259,12 @@ do { \
error:
if (src_surface == dst_surface)
{
IWineD3DSurface_Unmap((IWineD3DSurface *)dst_surface);
wined3d_surface_unmap(dst_surface);
}
else
{
IWineD3DSurface_Unmap((IWineD3DSurface *)dst_surface);
IWineD3DSurface_Unmap((IWineD3DSurface *)src_surface);
wined3d_surface_unmap(dst_surface);
wined3d_surface_unmap(src_surface);
}
return hr;
@ -7386,8 +7279,8 @@ static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceIm
memset(&BltFx, 0, sizeof(BltFx));
BltFx.dwSize = sizeof(BltFx);
BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface->resource.format, color);
return IWineD3DBaseSurfaceImpl_Blt((IWineD3DSurface*)dst_surface, dst_rect,
NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
return wined3d_surface_blt(dst_surface, dst_rect, NULL, NULL,
WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
}
/* Do not call while under the GL lock. */
@ -7469,7 +7362,6 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
return WINED3DERR_INVALIDCALL;
surface->surface_type = surface_type;
surface->lpVtbl = &IWineD3DSurface_Vtbl;
switch (surface_type)
{

View File

@ -41,7 +41,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (swapchain->front_buffer)
{
surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)swapchain->front_buffer))
if (wined3d_surface_decref(swapchain->front_buffer))
WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer);
swapchain->front_buffer = NULL;
}
@ -53,7 +53,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
while (i--)
{
surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)swapchain->back_buffers[i]))
if (wined3d_surface_decref(swapchain->back_buffers[i]))
WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]);
}
HeapFree(GetProcessHeap(), 0, swapchain->back_buffers);
@ -161,8 +161,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
if (swapchain->presentParms.Windowed)
MapWindowPoints(swapchain->win_handle, NULL, &offset, 1);
IWineD3DSurface_BltFast(dst_surface, offset.x, offset.y,
(IWineD3DSurface *)swapchain->front_buffer, NULL, 0);
wined3d_surface_bltfast(dst_surface, offset.x, offset.y, swapchain->front_buffer, NULL, 0);
return WINED3D_OK;
}
@ -187,8 +186,9 @@ HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *
return WINED3DERR_INVALIDCALL;
}
*back_buffer = (IWineD3DSurface *)swapchain->back_buffers[back_buffer_idx];
if (*back_buffer) IWineD3DSurface_AddRef(*back_buffer);
*back_buffer = swapchain->back_buffers[back_buffer_idx];
if (*back_buffer)
wined3d_surface_incref(*back_buffer);
TRACE("Returning back buffer %p.\n", *back_buffer);
@ -438,7 +438,6 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* allows to use the Blitting engine and avoid copying the whole texture -> render target blitting code.
*/
memset(&cursor, 0, sizeof(cursor));
cursor.lpVtbl = &IWineD3DSurface_Vtbl;
cursor.resource.ref = 1;
cursor.resource.device = swapchain->device;
cursor.resource.pool = WINED3DPOOL_SCRATCH;
@ -459,14 +458,14 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
*/
if (swapchain->presentParms.Windowed)
MapWindowPoints(NULL, swapchain->win_handle, (LPPOINT)&destRect, 2);
IWineD3DSurface_Blt((IWineD3DSurface *)swapchain->back_buffers[0], &destRect,
(IWineD3DSurface *)&cursor, NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT);
wined3d_surface_blt(swapchain->back_buffers[0], &destRect,
&cursor, NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT);
}
if (swapchain->device->logo_surface)
{
/* Blit the logo into the upper left corner of the drawable. */
IWineD3DSurface_BltFast((IWineD3DSurface *)swapchain->back_buffers[0], 0, 0,
wined3d_surface_bltfast(swapchain->back_buffers[0], 0, 0,
swapchain->device->logo_surface, NULL, WINEDDBLTFAST_SRCCOLORKEY);
}
@ -624,7 +623,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
swapchain->device->depth_stencil->resource.height);
if (swapchain->device->depth_stencil == swapchain->device->onscreen_depth_stencil)
{
IWineD3DSurface_Release((IWineD3DSurface *)swapchain->device->onscreen_depth_stencil);
wined3d_surface_decref(swapchain->device->onscreen_depth_stencil);
swapchain->device->onscreen_depth_stencil = NULL;
}
}
@ -1069,7 +1068,8 @@ err:
{
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
{
if (swapchain->back_buffers[i]) IWineD3DSurface_Release((IWineD3DSurface *)swapchain->back_buffers[i]);
if (swapchain->back_buffers[i])
wined3d_surface_decref(swapchain->back_buffers[i]);
}
HeapFree(GetProcessHeap(), 0, swapchain->back_buffers);
}
@ -1085,7 +1085,8 @@ err:
HeapFree(GetProcessHeap(), 0, swapchain->context);
}
if (swapchain->front_buffer) IWineD3DSurface_Release((IWineD3DSurface *)swapchain->front_buffer);
if (swapchain->front_buffer)
wined3d_surface_decref(swapchain->front_buffer);
return hr;
}

View File

@ -758,7 +758,7 @@ static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource
surface_set_texture_name(surface, 0, FALSE);
surface_set_texture_target(surface, 0);
surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL);
IWineD3DSurface_Release((IWineD3DSurface *)surface);
wined3d_surface_decref(surface);
}
/* Do not call while under the GL lock. */

View File

@ -76,6 +76,40 @@
@ cdecl wined3d_stateblock_decref(ptr)
@ cdecl wined3d_stateblock_incref(ptr)
@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long)
@ cdecl wined3d_surface_bltfast(ptr long long ptr ptr long)
@ cdecl wined3d_surface_decref(ptr)
@ cdecl wined3d_surface_flip(ptr ptr long)
@ cdecl wined3d_surface_free_private_data(ptr ptr)
@ cdecl wined3d_surface_get_blt_status(ptr long)
@ cdecl wined3d_surface_get_clipper(ptr)
@ cdecl wined3d_surface_get_flip_status(ptr long)
@ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr)
@ cdecl wined3d_surface_get_palette(ptr)
@ cdecl wined3d_surface_get_parent(ptr)
@ cdecl wined3d_surface_get_pitch(ptr)
@ cdecl wined3d_surface_get_priority(ptr)
@ cdecl wined3d_surface_get_private_data(ptr ptr ptr ptr)
@ cdecl wined3d_surface_get_resource(ptr)
@ cdecl wined3d_surface_getdc(ptr ptr)
@ cdecl wined3d_surface_incref(ptr)
@ cdecl wined3d_surface_is_lost(ptr)
@ cdecl wined3d_surface_map(ptr ptr ptr long)
@ cdecl wined3d_surface_preload(ptr)
@ cdecl wined3d_surface_releasedc(ptr ptr)
@ cdecl wined3d_surface_restore(ptr)
@ cdecl wined3d_surface_set_clipper(ptr ptr)
@ cdecl wined3d_surface_set_color_key(ptr long ptr)
@ cdecl wined3d_surface_set_format(ptr long)
@ cdecl wined3d_surface_set_mem(ptr ptr)
@ cdecl wined3d_surface_set_overlay_position(ptr long long)
@ cdecl wined3d_surface_set_palette(ptr ptr)
@ cdecl wined3d_surface_set_priority(ptr long)
@ cdecl wined3d_surface_set_private_data(ptr ptr ptr long long)
@ cdecl wined3d_surface_unmap(ptr)
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr)
@ cdecl wined3d_swapchain_decref(ptr)
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long ptr)
@ cdecl wined3d_swapchain_get_device(ptr)

View File

@ -52,8 +52,9 @@
#define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
#define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct wined3d_surface IWineD3DSurfaceImpl;
typedef struct wined3d_surface IWineD3DSurface;
/* Texture format fixups */
@ -2018,33 +2019,26 @@ struct wined3d_subresource_container
struct wined3d_surface_ops
{
HRESULT (*surface_private_setup)(struct IWineD3DSurfaceImpl *surface);
void (*surface_cleanup)(struct IWineD3DSurfaceImpl *surface);
void (*surface_realize_palette)(struct IWineD3DSurfaceImpl *surface);
HRESULT (*surface_draw_overlay)(struct IWineD3DSurfaceImpl *surface);
void (*surface_preload)(struct IWineD3DSurfaceImpl *surface);
void (*surface_map)(struct IWineD3DSurfaceImpl *surface, const RECT *rect, DWORD flags);
void (*surface_unmap)(struct IWineD3DSurfaceImpl *surface);
HRESULT (*surface_getdc)(struct IWineD3DSurfaceImpl *surface);
HRESULT (*surface_flip)(struct IWineD3DSurfaceImpl *surface, struct IWineD3DSurfaceImpl *override);
HRESULT (*surface_blt)(struct IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect,
IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD flags,
HRESULT (*surface_private_setup)(struct wined3d_surface *surface);
void (*surface_cleanup)(struct wined3d_surface *surface);
void (*surface_realize_palette)(struct wined3d_surface *surface);
HRESULT (*surface_draw_overlay)(struct wined3d_surface *surface);
void (*surface_preload)(struct wined3d_surface *surface);
void (*surface_map)(struct wined3d_surface *surface, const RECT *rect, DWORD flags);
void (*surface_unmap)(struct wined3d_surface *surface);
HRESULT (*surface_getdc)(struct wined3d_surface *surface);
HRESULT (*surface_flip)(struct wined3d_surface *surface, struct wined3d_surface *override);
HRESULT (*surface_blt)(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter);
HRESULT (*surface_bltfast)(struct IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DWORD dst_y,
IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD trans);
HRESULT (*surface_set_mem)(struct IWineD3DSurfaceImpl *surface, void *mem);
HRESULT (*surface_bltfast)(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans);
HRESULT (*surface_set_mem)(struct wined3d_surface *surface, void *mem);
};
/*****************************************************************************
* IWineD3DSurface implementation structure
*/
struct IWineD3DSurfaceImpl
struct wined3d_surface
{
/* IUnknown & IWineD3DResource Information */
const IWineD3DSurfaceVtbl *lpVtbl;
struct wined3d_resource resource;
/* IWineD3DSurface fields */
const struct wined3d_surface_ops *surface_ops;
struct wined3d_subresource_container container;
struct wined3d_palette *palette; /* D3D7 style palette handling */
@ -2099,8 +2093,6 @@ struct IWineD3DSurfaceImpl
struct list overlay_entry;
};
extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl DECLSPEC_HIDDEN;
static inline IWineD3DSurfaceImpl *surface_from_resource(struct wined3d_resource *resource)
{
return CONTAINING_RECORD(resource, IWineD3DSurfaceImpl, resource);

View File

@ -1996,13 +1996,13 @@ typedef struct _WINEDDBLTFX
union
{
DWORD dwZDestConst; /* Constant to use as Z buffer for dest */
struct IWineD3DSurface *lpDDSZBufferDest; /* Surface to use as Z buffer for dest */
struct wined3d_surface *lpDDSZBufferDest; /* Surface to use as Z buffer for dest */
} DUMMYUNIONNAME1;
DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */
union
{
DWORD dwZSrcConst; /* Constant to use as Z buffer for src */
struct IWineD3DSurface *lpDDSZBufferSrc; /* Surface to use as Z buffer for src */
struct wined3d_surface *lpDDSZBufferSrc; /* Surface to use as Z buffer for src */
} DUMMYUNIONNAME2;
DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */
DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */
@ -2011,20 +2011,20 @@ typedef struct _WINEDDBLTFX
union
{
DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */
struct IWineD3DSurface *lpDDSAlphaDest; /* Surface to use as Alpha Channel */
struct wined3d_surface *lpDDSAlphaDest; /* Surface to use as Alpha Channel */
} DUMMYUNIONNAME3;
DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */
union
{
DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */
struct IWineD3DSurface *lpDDSAlphaSrc; /* Surface to use as Alpha Channel */
struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as Alpha Channel */
} DUMMYUNIONNAME4;
union
{
DWORD dwFillColor; /* color in RGB or Palettized */
DWORD dwFillDepth; /* depth value for z-buffer */
DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */
struct IWineD3DSurface *lpDDSPattern; /* Surface to use as pattern */
struct wined3d_surface *lpDDSPattern; /* Surface to use as pattern */
} DUMMYUNIONNAME5;
WINEDDCOLORKEY ddckDestColorkey; /* DestColorkey override */
WINEDDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */
@ -2040,13 +2040,13 @@ typedef struct _WINEDDOVERLAYFX
union
{
DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */
struct IWineD3DSurface *lpDDSAlphaDest; /* Surface to use as alpha channel for dest */
struct wined3d_surface *lpDDSAlphaDest; /* Surface to use as alpha channel for dest */
} DUMMYUNIONNAME1;
DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */
union
{
DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */
struct IWineD3DSurface *lpDDSAlphaSrc; /* Surface to use as alpha channel for src */
struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as alpha channel for src */
} DUMMYUNIONNAME2;
WINEDDCOLORKEY dckDestColorkey; /* DestColorkey override */
WINEDDCOLORKEY dckSrcColorkey; /* SrcColorkey override */
@ -2085,7 +2085,6 @@ struct wined3d_parent_ops
void (__stdcall *wined3d_object_destroyed)(void *parent);
};
interface IWineD3DSurface;
interface IWineD3DDevice;
struct wined3d;
struct wined3d_buffer;
@ -2096,6 +2095,7 @@ struct wined3d_resource;
struct wined3d_rendertarget_view;
struct wined3d_shader;
struct wined3d_stateblock;
struct wined3d_surface;
struct wined3d_swapchain;
struct wined3d_texture;
struct wined3d_vertex_declaration;
@ -2121,7 +2121,7 @@ interface IWineD3DDeviceParent : IUnknown
[in] WINED3DPOOL pool,
[in] UINT level,
[in] WINED3DCUBEMAP_FACES face,
[out] IWineD3DSurface **surface
[out] struct wined3d_surface **surface
);
HRESULT CreateRenderTarget(
@ -2132,7 +2132,7 @@ interface IWineD3DDeviceParent : IUnknown
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality,
[in] BOOL lockable,
[out] IWineD3DSurface **surface
[out] struct wined3d_surface **surface
);
HRESULT CreateDepthStencilSurface(
@ -2142,7 +2142,7 @@ interface IWineD3DDeviceParent : IUnknown
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality,
[in] BOOL discard,
[out] IWineD3DSurface **surface
[out] struct wined3d_surface **surface
);
HRESULT CreateVolume(
@ -2163,125 +2163,6 @@ interface IWineD3DDeviceParent : IUnknown
}
typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData);
[
object,
local,
uuid(37cd5526-6f30-11d9-c687-00046142c14f)
]
interface IWineD3DSurface : IUnknown
{
void *GetParent(
);
HRESULT SetPrivateData(
[in] REFGUID guid,
[in] const void *data,
[in] DWORD data_size,
[in] DWORD flags
);
HRESULT GetPrivateData(
[in] REFGUID guid,
[out] void *data,
[in, out] DWORD *data_size
);
HRESULT FreePrivateData(
[in] REFGUID guid
);
DWORD SetPriority(
[in] DWORD new_priority
);
DWORD GetPriority(
);
void PreLoad(
);
struct wined3d_resource *GetResource(
);
HRESULT Map(
[out] WINED3DLOCKED_RECT *locked_rect,
[in] const RECT *rect,
[in] DWORD flags
);
HRESULT Unmap(
);
HRESULT GetDC(
[out] HDC *dc
);
HRESULT ReleaseDC(
[in] HDC dc
);
HRESULT Flip(
[in] IWineD3DSurface *override,
[in] DWORD flags
);
HRESULT Blt(
[in] const RECT *dst_rect,
[in] IWineD3DSurface *src_surface,
[in] const RECT *src_rect,
[in] DWORD flags,
[in] const WINEDDBLTFX *blt_fx,
[in] WINED3DTEXTUREFILTERTYPE filter
);
HRESULT GetBltStatus(
[in] DWORD flags
);
HRESULT GetFlipStatus(
[in] DWORD flags
);
HRESULT IsLost(
);
HRESULT Restore(
);
HRESULT BltFast(
[in] DWORD dst_x,
[in] DWORD dst_y,
[in] IWineD3DSurface *src_surface,
[in] const RECT *src_rect,
[in] DWORD trans
);
HRESULT GetPalette(
[out] struct wined3d_palette **palette
);
HRESULT SetPalette(
[in] struct wined3d_palette *palette
);
HRESULT SetColorKey(
[in] DWORD flags,
[in] const WINEDDCOLORKEY *color_key
);
DWORD GetPitch(
);
HRESULT SetMem(
[in] void *mem
);
HRESULT SetOverlayPosition(
[in] LONG x,
[in] LONG y
);
HRESULT GetOverlayPosition(
[out] LONG *x,
[out] LONG *y
);
HRESULT UpdateOverlayZOrder(
[in] DWORD flags,
[in] IWineD3DSurface *ref
);
HRESULT UpdateOverlay(
[in] const RECT *src_rect,
[in] IWineD3DSurface *dst_surface,
[in] const RECT *dst_rect,
[in] DWORD flags,
[in] const WINEDDOVERLAYFX *fx
);
HRESULT SetClipper(
[in] struct wined3d_clipper *clipper
);
HRESULT GetClipper(
[out] struct wined3d_clipper **clipper
);
HRESULT SetFormat(
[in] enum wined3d_format_id format_id
);
}
[
object,
local,
@ -2330,7 +2211,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DSURFTYPE surface_type,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DSurface **surface
[out] struct wined3d_surface **surface
);
HRESULT CreateRendertargetView(
[in] struct wined3d_resource *resource,
@ -2452,7 +2333,7 @@ interface IWineD3DDevice : IUnknown
[in] UINT swapchain_idx,
[in] UINT backbuffer_idx,
[in] WINED3DBACKBUFFER_TYPE backbuffer_type,
[out] IWineD3DSurface **backbuffer
[out] struct wined3d_surface **backbuffer
);
HRESULT GetCreationParameters(
[out] WINED3DDEVICE_CREATION_PARAMETERS *creation_parameters
@ -2490,7 +2371,7 @@ interface IWineD3DDevice : IUnknown
HRESULT SetCursorProperties(
[in] UINT x_hotspot,
[in] UINT y_hotspot,
[in] IWineD3DSurface *cursor_surface
[in] struct wined3d_surface *cursor_surface
);
void SetCursorPosition(
[in] int x_screen_space,
@ -2521,10 +2402,10 @@ interface IWineD3DDevice : IUnknown
[out] UINT *palette_number
);
HRESULT SetDepthStencilSurface(
[in] IWineD3DSurface *depth_stencil
[in] struct wined3d_surface *depth_stencil
);
HRESULT GetDepthStencilSurface(
[out] IWineD3DSurface **depth_stencil
[out] struct wined3d_surface **depth_stencil
);
void SetGammaRamp(
[in] UINT swapchain_idx,
@ -2628,12 +2509,12 @@ interface IWineD3DDevice : IUnknown
);
HRESULT SetRenderTarget(
[in] DWORD render_target_idx,
[in] IWineD3DSurface *render_target,
[in] struct wined3d_surface *render_target,
[in] BOOL set_viewport
);
HRESULT GetRenderTarget(
[in] DWORD render_target_idx,
[out] IWineD3DSurface **render_target
[out] struct wined3d_surface **render_target
);
HRESULT SetSamplerState(
[in] DWORD sampler_idx,
@ -2843,7 +2724,7 @@ interface IWineD3DDevice : IUnknown
[in] UINT handle
);
HRESULT ColorFill(
[in] IWineD3DSurface *surface,
[in] struct wined3d_surface *surface,
[in] const RECT *rect,
[in] const WINED3DCOLORVALUE *color
);
@ -2852,14 +2733,14 @@ interface IWineD3DDevice : IUnknown
[in] struct wined3d_texture *dst_texture
);
HRESULT UpdateSurface(
[in] IWineD3DSurface *src_surface,
[in] struct wined3d_surface *src_surface,
[in] const RECT *src_rect,
[in] IWineD3DSurface *dst_surface,
[in] struct wined3d_surface *dst_surface,
[in] const POINT *dst_point
);
HRESULT GetFrontBufferData(
[in] UINT swapchain_idx,
[in] IWineD3DSurface *dst_surface
[in] struct wined3d_surface *dst_surface
);
HRESULT EnumResources(
[in] D3DCB_ENUMRESOURCES callback,
@ -2867,7 +2748,7 @@ interface IWineD3DDevice : IUnknown
);
HRESULT GetSurfaceFromDC(
[in] HDC dc,
[out] IWineD3DSurface **surface
[out] struct wined3d_surface **surface
);
HRESULT AcquireFocusWindow(
[in] HWND window
@ -2988,14 +2869,57 @@ HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *blt_fx, WINED3DTEXTUREFILTERTYPE filter);
HRESULT __cdecl wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans);
ULONG __cdecl wined3d_surface_decref(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags);
HRESULT __cdecl wined3d_surface_free_private_data(struct wined3d_surface *surface, REFGUID guid);
HRESULT __cdecl wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags);
struct wined3d_clipper * __cdecl wined3d_surface_get_clipper(const struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_get_flip_status(const struct wined3d_surface *surface, DWORD flags);
HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y);
struct wined3d_palette * __cdecl wined3d_surface_get_palette(const struct wined3d_surface *surface);
void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_priority(const struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_get_private_data(const struct wined3d_surface *surface,
REFGUID guid, void *data, DWORD *data_size);
struct wined3d_resource * __cdecl wined3d_surface_get_resource(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc);
ULONG __cdecl wined3d_surface_incref(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_is_lost(const struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_map(struct wined3d_surface *surface,
WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags);
void __cdecl wined3d_surface_preload(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc);
HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_set_clipper(struct wined3d_surface *surface, struct wined3d_clipper *clipper);
HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface,
DWORD flags, const WINEDDCOLORKEY *color_key);
HRESULT __cdecl wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id);
HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem);
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
HRESULT __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette);
DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority);
HRESULT __cdecl wined3d_surface_set_private_data(struct wined3d_surface *surface,
REFGUID guid, const void *data, DWORD data_size, DWORD flags);
HRESULT __cdecl wined3d_surface_unmap(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx);
HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
DWORD flags, struct wined3d_surface *ref);
ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer);
UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, struct wined3d_surface **backbuffer);
IWineD3DDevice * __cdecl wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
WINED3DDISPLAYMODE *mode);
HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
IWineD3DSurface *dst_surface);
struct wined3d_surface *dst_surface);
HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
WINED3DGAMMARAMP *ramp);
void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain);