wined3d: Remove SetContainer() from the public IWineD3DSurface interface.

This commit is contained in:
Henri Verbeet 2010-08-16 20:00:23 +02:00 committed by Alexandre Julliard
parent 89e6a60732
commit 61db577a4b
10 changed files with 55 additions and 71 deletions

View File

@ -127,7 +127,7 @@ static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This)
surface_set_texture_name(surface, 0, TRUE);
surface_set_texture_name(surface, 0, FALSE);
surface_set_texture_target(surface, 0);
IWineD3DSurface_SetContainer((IWineD3DSurface *)surface, NULL);
surface_set_container(surface, NULL);
IWineD3DSurface_Release((IWineD3DSurface *)surface);
}
}
@ -558,7 +558,7 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
return hr;
}
IWineD3DSurface_SetContainer(surface, (IWineD3DBase *)texture);
surface_set_container((IWineD3DSurfaceImpl *)surface, (IWineD3DBase *)texture);
surface_set_texture_target((IWineD3DSurfaceImpl *)surface, cube_targets[j]);
texture->baseTexture.sub_resources[idx] = (IWineD3DResourceImpl *)surface;
TRACE("Created surface level %u @ %p.\n", i, surface);

View File

@ -5651,14 +5651,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetFrontBackBuffers(IWineD3DDevice *ifa
if (swapchain->front_buffer)
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)swapchain->front_buffer, NULL);
surface_set_container(swapchain->front_buffer, NULL);
swapchain->front_buffer->Flags &= ~SFLAG_SWAPCHAIN;
}
swapchain->front_buffer = front_impl;
if (front)
if (front_impl)
{
IWineD3DSurface_SetContainer(front, (IWineD3DBase *)swapchain);
surface_set_container(front_impl, (IWineD3DBase *)swapchain);
front_impl->Flags |= SFLAG_SWAPCHAIN;
}
}
@ -5669,19 +5669,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetFrontBackBuffers(IWineD3DDevice *ifa
if (swapchain->back_buffers[0])
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)swapchain->back_buffers[0], NULL);
surface_set_container(swapchain->back_buffers[0], NULL);
swapchain->back_buffers[0]->Flags &= ~SFLAG_SWAPCHAIN;
}
swapchain->back_buffers[0] = back_impl;
if (back)
if (back_impl)
{
swapchain->presentParms.BackBufferWidth = back_impl->currentDesc.Width;
swapchain->presentParms.BackBufferHeight = back_impl->currentDesc.Height;
swapchain->presentParms.BackBufferFormat = back_impl->resource.format_desc->format;
swapchain->presentParms.BackBufferCount = 1;
IWineD3DSurface_SetContainer(back, (IWineD3DBase *)swapchain);
surface_set_container(back_impl, (IWineD3DBase *)swapchain);
back_impl->Flags |= SFLAG_SWAPCHAIN;
}
else

View File

@ -92,6 +92,42 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
resource_cleanup((IWineD3DResource *)This);
}
void surface_set_container(IWineD3DSurfaceImpl *surface, IWineD3DBase *container)
{
IWineD3DSwapChain *swapchain = NULL;
TRACE("surface %p, container %p.\n", surface, container);
if (container)
{
IWineD3DBase_QueryInterface(container, &IID_IWineD3DSwapChain, (void **)&swapchain);
}
if (swapchain)
{
surface->get_drawable_size = get_drawable_size_swapchain;
IWineD3DSwapChain_Release(swapchain);
}
else
{
switch (wined3d_settings.offscreen_rendering_mode)
{
case ORM_FBO:
surface->get_drawable_size = get_drawable_size_fbo;
break;
case ORM_BACKBUFFER:
surface->get_drawable_size = get_drawable_size_backbuffer;
break;
default:
ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode);
return;
}
}
surface->container = container;
}
struct blt_info
{
GLenum binding;
@ -360,7 +396,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
}
/* "Standalone" surface. */
IWineD3DSurface_SetContainer((IWineD3DSurface *)surface, NULL);
surface_set_container(surface, NULL);
surface->currentDesc.Width = width;
surface->currentDesc.Height = height;
@ -4644,40 +4680,6 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3DBase *container)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DSwapChain *swapchain = NULL;
/* Update the drawable size method */
if(container) {
IWineD3DBase_QueryInterface(container, &IID_IWineD3DSwapChain, (void **) &swapchain);
}
if(swapchain) {
This->get_drawable_size = get_drawable_size_swapchain;
IWineD3DSwapChain_Release(swapchain);
}
else
{
switch (wined3d_settings.offscreen_rendering_mode)
{
case ORM_FBO:
This->get_drawable_size = get_drawable_size_fbo;
break;
case ORM_BACKBUFFER:
This->get_drawable_size = get_drawable_size_backbuffer;
break;
default:
ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode);
return WINED3DERR_INVALIDCALL;
}
}
return IWineD3DBaseSurfaceImpl_SetContainer(iface, container);
}
static WINED3DSURFTYPE WINAPI IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *iface) {
return SURFACE_OPENGL;
}
@ -4764,7 +4766,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
/* Internal use: */
IWineD3DSurfaceImpl_LoadTexture,
IWineD3DSurfaceImpl_BindTexture,
IWineD3DSurfaceImpl_SetContainer,
IWineD3DBaseSurfaceImpl_GetData,
IWineD3DSurfaceImpl_SetFormat,
IWineD3DSurfaceImpl_PrivateSetup,

View File

@ -485,19 +485,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD
return WINED3D_OK;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3DBase *container) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("This %p, container %p\n", This, container);
/* We can't keep a reference to the container, since the container already keeps a reference to us. */
TRACE("Setting container to %p from %p\n", container, This->container);
This->container = container;
return WINED3D_OK;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format,

View File

@ -531,7 +531,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
/* Internal use: */
IWineGDISurfaceImpl_LoadTexture,
IWineGDISurfaceImpl_BindTexture,
IWineD3DBaseSurfaceImpl_SetContainer,
IWineD3DBaseSurfaceImpl_GetData,
IWineD3DBaseSurfaceImpl_SetFormat,
IWineGDISurfaceImpl_PrivateSetup,

View File

@ -48,7 +48,7 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
* the last buffer to be destroyed, FindContext() depends on that. */
if (This->front_buffer)
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)This->front_buffer, NULL);
surface_set_container(This->front_buffer, NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)This->front_buffer))
{
WARN("(%p) Something's still holding the front buffer (%p).\n",
@ -63,7 +63,7 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
while (i--)
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)This->back_buffers[i], NULL);
surface_set_container(This->back_buffers[i], NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)This->back_buffers[i]))
WARN("(%p) Something's still holding back buffer %u (%p).\n",
This, i, This->back_buffers[i]);
@ -731,7 +731,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
goto err;
}
IWineD3DSurface_SetContainer((IWineD3DSurface *)swapchain->front_buffer, (IWineD3DBase *)swapchain);
surface_set_container(swapchain->front_buffer, (IWineD3DBase *)swapchain);
swapchain->front_buffer->Flags |= SFLAG_SWAPCHAIN;
if (surface_type == SURFACE_OPENGL)
{
@ -847,7 +847,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
goto err;
}
IWineD3DSurface_SetContainer((IWineD3DSurface *)swapchain->back_buffers[i], (IWineD3DBase *)swapchain);
surface_set_container(swapchain->back_buffers[i], (IWineD3DBase *)swapchain);
swapchain->back_buffers[i]->Flags |= SFLAG_SWAPCHAIN;
}
}
@ -869,7 +869,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
goto err;
}
IWineD3DSurface_SetContainer((IWineD3DSurface *)device->auto_depth_stencil, NULL);
surface_set_container(device->auto_depth_stencil, NULL);
}
}

View File

@ -39,7 +39,7 @@ static void WINAPI IWineGDISwapChainImpl_Destroy(IWineD3DSwapChain *iface)
/* release the ref to the front and back buffer parents */
if (This->front_buffer)
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)This->front_buffer, NULL);
surface_set_container(This->front_buffer, NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)This->front_buffer) > 0)
{
WARN("(%p) Something's still holding the front buffer\n",This);
@ -51,7 +51,7 @@ static void WINAPI IWineGDISwapChainImpl_Destroy(IWineD3DSwapChain *iface)
UINT i;
for (i = 0; i < This->presentParms.BackBufferCount; ++i)
{
IWineD3DSurface_SetContainer((IWineD3DSurface *)This->back_buffers[i], NULL);
surface_set_container(This->back_buffers[i], NULL);
if (IWineD3DSurface_Release((IWineD3DSurface *)This->back_buffers[i]))
{
WARN("(%p) Something's still holding the back buffer\n",This);

View File

@ -119,7 +119,7 @@ static void texture_cleanup(IWineD3DTextureImpl *This)
surface_set_texture_name(surface, 0, TRUE);
surface_set_texture_name(surface, 0, FALSE);
surface_set_texture_target(surface, 0);
IWineD3DSurface_SetContainer((IWineD3DSurface *)surface, NULL);
surface_set_container(surface, NULL);
IWineD3DSurface_Release((IWineD3DSurface *)surface);
}
}
@ -611,7 +611,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
return hr;
}
IWineD3DSurface_SetContainer(surface, (IWineD3DBase *)texture);
surface_set_container((IWineD3DSurfaceImpl *)surface, (IWineD3DBase *)texture);
surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->target);
texture->baseTexture.sub_resources[i] = (IWineD3DResourceImpl *)surface;
TRACE("Created surface level %u @ %p.\n", i, surface);

View File

@ -2087,6 +2087,7 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface,
unsigned int width, unsigned int height) DECLSPEC_HIDDEN;
void surface_set_container(IWineD3DSurfaceImpl *surface, IWineD3DBase *container) DECLSPEC_HIDDEN;
void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN;
void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
@ -2115,7 +2116,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, IWineD3DPalette *Pal) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface,
DWORD Flags, const WINEDDCOLORKEY *CKey) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3DBase *container) DECLSPEC_HIDDEN;
DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) DECLSPEC_HIDDEN;

View File

@ -2481,9 +2481,6 @@ interface IWineD3DSurface : IWineD3DResource
void BindTexture(
[in] BOOL srgb
);
HRESULT SetContainer(
[in] IWineD3DBase *container
);
const void *GetData(
);
HRESULT SetFormat(