diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 457ba090e94..c53a61b4670 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -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 diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 4df04f1da7d..1609baf01b5 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -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, diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c index fb289a649a4..75cb4b50c55 100644 --- a/dlls/d3d10core/view.c +++ b/dlls/d3d10core/view.c @@ -19,6 +19,7 @@ #include "config.h" #include "wine/port.h" +#include #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);