d3d10core: Use unsafe_impl_from_ID3D10RenderTargetView for app provided ifaces.

This commit is contained in:
Michael Stefaniuc 2011-07-12 12:34:22 +02:00 committed by Alexandre Julliard
parent 14e93e79d6
commit 0b78866a0f
3 changed files with 18 additions and 3 deletions

View File

@ -141,6 +141,7 @@ struct d3d10_rendertarget_view
HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc) DECLSPEC_HIDDEN;
struct d3d10_rendertarget_view *unsafe_impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface) DECLSPEC_HIDDEN;
/* ID3D10ShaderResourceView */
struct d3d10_shader_resource_view

View File

@ -383,14 +383,13 @@ static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *i
ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
{
struct d3d10_device *This = impl_from_ID3D10Device(iface);
struct wined3d_rendertarget_view *wined3d_view;
struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
const WINED3DCOLORVALUE color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
wined3d_device_clear_rendertarget_view(This->wined3d_device, wined3d_view, &color);
wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
}
static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#define NONAMELESSUNION
#include "d3d10core_private.h"
@ -291,6 +292,11 @@ HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view)
return S_OK;
}
static inline struct d3d10_rendertarget_view *impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_rendertarget_view, vtbl);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_QueryInterface(ID3D10RenderTargetView *iface,
@ -468,6 +474,15 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
return S_OK;
}
struct d3d10_rendertarget_view *unsafe_impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d10_rendertarget_view_vtbl);
return impl_from_ID3D10RenderTargetView(iface);
}
static inline struct d3d10_shader_resource_view *impl_from_ID3D10ShaderResourceView(ID3D10ShaderResourceView *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_shader_resource_view, ID3D10ShaderResourceView_iface);