Commit 0c11c316 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Get rid of IDirect3DViewportImpl.

parent ddfb19e9
...@@ -4271,7 +4271,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 ...@@ -4271,7 +4271,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
IUnknown *outer_unknown) IUnknown *outer_unknown)
{ {
struct ddraw *ddraw = impl_from_IDirect3D3(iface); struct ddraw *ddraw = impl_from_IDirect3D3(iface);
IDirect3DViewportImpl *object; struct d3d_viewport *object;
TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown); TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
......
...@@ -42,7 +42,6 @@ extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HI ...@@ -42,7 +42,6 @@ extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HI
/* Typdef the interfaces */ /* Typdef the interfaces */
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl; typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl; typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl; typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl; typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
...@@ -290,7 +289,7 @@ struct IDirect3DDeviceImpl ...@@ -290,7 +289,7 @@ struct IDirect3DDeviceImpl
/* Viewport management */ /* Viewport management */
struct list viewport_list; struct list viewport_list;
IDirect3DViewportImpl *current_viewport; struct d3d_viewport *current_viewport;
D3DVIEWPORT7 active_viewport; D3DVIEWPORT7 active_viewport;
/* Required to keep track which of two available texture blending modes in d3ddevice3 is used */ /* Required to keep track which of two available texture blending modes in d3ddevice3 is used */
...@@ -410,7 +409,7 @@ struct d3d_light ...@@ -410,7 +409,7 @@ struct d3d_light
struct ddraw *ddraw; struct ddraw *ddraw;
/* If this light is active for one viewport, put the viewport here */ /* If this light is active for one viewport, put the viewport here */
IDirect3DViewportImpl *active_viewport; struct d3d_viewport *active_viewport;
D3DLIGHT2 light; D3DLIGHT2 light;
D3DLIGHT7 light7; D3DLIGHT7 light7;
...@@ -451,7 +450,7 @@ IDirect3DMaterialImpl *d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN; ...@@ -451,7 +450,7 @@ IDirect3DMaterialImpl *d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DViewport - Wraps to D3D7 * IDirect3DViewport - Wraps to D3D7
*****************************************************************************/ *****************************************************************************/
struct IDirect3DViewportImpl struct d3d_viewport
{ {
IDirect3DViewport3 IDirect3DViewport3_iface; IDirect3DViewport3 IDirect3DViewport3_iface;
LONG ref; LONG ref;
...@@ -480,13 +479,13 @@ struct IDirect3DViewportImpl ...@@ -480,13 +479,13 @@ struct IDirect3DViewportImpl
IDirect3DMaterialImpl *background; IDirect3DMaterialImpl *background;
}; };
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface) DECLSPEC_HIDDEN; struct d3d_viewport *unsafe_impl_from_IDirect3DViewport3(IDirect3DViewport3 *iface) DECLSPEC_HIDDEN;
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface) DECLSPEC_HIDDEN; struct d3d_viewport *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *iface) DECLSPEC_HIDDEN;
IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface) DECLSPEC_HIDDEN; struct d3d_viewport *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface) DECLSPEC_HIDDEN;
/* Helper functions */ /* Helper functions */
void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) DECLSPEC_HIDDEN; void viewport_activate(struct d3d_viewport *viewport, BOOL ignore_lights) DECLSPEC_HIDDEN;
void d3d_viewport_init(IDirect3DViewportImpl *viewport, struct ddraw *ddraw) DECLSPEC_HIDDEN; void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DExecuteBuffer - Wraps to D3D7 * IDirect3DExecuteBuffer - Wraps to D3D7
...@@ -519,7 +518,7 @@ IDirect3DExecuteBufferImpl *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExe ...@@ -519,7 +518,7 @@ IDirect3DExecuteBufferImpl *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExe
/* The execute function */ /* The execute function */
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *execute_buffer, HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *execute_buffer,
IDirect3DDeviceImpl *device, IDirect3DViewportImpl *viewport) DECLSPEC_HIDDEN; IDirect3DDeviceImpl *device, struct d3d_viewport *viewport) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DVertexBuffer * IDirect3DVertexBuffer
......
...@@ -778,7 +778,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface, ...@@ -778,7 +778,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface);
IDirect3DExecuteBufferImpl *buffer = unsafe_impl_from_IDirect3DExecuteBuffer(ExecuteBuffer); IDirect3DExecuteBufferImpl *buffer = unsafe_impl_from_IDirect3DExecuteBuffer(ExecuteBuffer);
IDirect3DViewportImpl *Direct3DViewportImpl = unsafe_impl_from_IDirect3DViewport(Viewport); struct d3d_viewport *viewport_impl = unsafe_impl_from_IDirect3DViewport(Viewport);
HRESULT hr; HRESULT hr;
TRACE("iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, Viewport, Flags); TRACE("iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, Viewport, Flags);
...@@ -788,7 +788,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface, ...@@ -788,7 +788,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
/* Execute... */ /* Execute... */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = d3d_execute_buffer_execute(buffer, This, Direct3DViewportImpl); hr = d3d_execute_buffer_execute(buffer, This, viewport_impl);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -816,7 +816,7 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface, ...@@ -816,7 +816,7 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface,
IDirect3DViewport3 *Viewport) IDirect3DViewport3 *Viewport)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport3(Viewport); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport3(Viewport);
TRACE("iface %p, viewport %p.\n", iface, Viewport); TRACE("iface %p, viewport %p.\n", iface, Viewport);
...@@ -837,7 +837,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface, ...@@ -837,7 +837,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface,
IDirect3DViewport2 *Direct3DViewport2) IDirect3DViewport2 *Direct3DViewport2)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);
...@@ -848,7 +848,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface, ...@@ -848,7 +848,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
IDirect3DViewport *Direct3DViewport) IDirect3DViewport *Direct3DViewport)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport);
...@@ -874,7 +874,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface, ...@@ -874,7 +874,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
static HRESULT WINAPI IDirect3DDeviceImpl_3_DeleteViewport(IDirect3DDevice3 *iface, IDirect3DViewport3 *viewport) static HRESULT WINAPI IDirect3DDeviceImpl_3_DeleteViewport(IDirect3DDevice3 *iface, IDirect3DViewport3 *viewport)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport3(viewport); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport3(viewport);
TRACE("iface %p, viewport %p.\n", iface, viewport); TRACE("iface %p, viewport %p.\n", iface, viewport);
...@@ -899,7 +899,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *ifa ...@@ -899,7 +899,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *ifa
IDirect3DViewport2 *Direct3DViewport2) IDirect3DViewport2 *Direct3DViewport2)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);
...@@ -910,7 +910,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *ifac ...@@ -910,7 +910,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *ifac
IDirect3DViewport *Direct3DViewport) IDirect3DViewport *Direct3DViewport)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport(Direct3DViewport);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport);
...@@ -942,8 +942,8 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface, ...@@ -942,8 +942,8 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface,
DWORD Flags) DWORD Flags)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport3(Viewport3); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport3(Viewport3);
IDirect3DViewportImpl *next; struct d3d_viewport *next;
struct list *entry; struct list *entry;
TRACE("iface %p, viewport %p, next %p, flags %#x.\n", TRACE("iface %p, viewport %p, next %p, flags %#x.\n",
...@@ -980,7 +980,7 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface, ...@@ -980,7 +980,7 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface,
if (entry) if (entry)
{ {
next = LIST_ENTRY(entry, IDirect3DViewportImpl, entry); next = LIST_ENTRY(entry, struct d3d_viewport, entry);
*lplpDirect3DViewport3 = &next->IDirect3DViewport3_iface; *lplpDirect3DViewport3 = &next->IDirect3DViewport3_iface;
} }
else else
...@@ -995,7 +995,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface ...@@ -995,7 +995,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface
IDirect3DViewport2 *Viewport2, IDirect3DViewport2 **lplpDirect3DViewport2, DWORD Flags) IDirect3DViewport2 *Viewport2, IDirect3DViewport2 **lplpDirect3DViewport2, DWORD Flags)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Viewport2); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport2(Viewport2);
IDirect3DViewport3 *res; IDirect3DViewport3 *res;
HRESULT hr; HRESULT hr;
...@@ -1012,7 +1012,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface, ...@@ -1012,7 +1012,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface,
IDirect3DViewport *Viewport, IDirect3DViewport **lplpDirect3DViewport, DWORD Flags) IDirect3DViewport *Viewport, IDirect3DViewport **lplpDirect3DViewport, DWORD Flags)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport(Viewport); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport(Viewport);
IDirect3DViewport3 *res; IDirect3DViewport3 *res;
HRESULT hr; HRESULT hr;
...@@ -1787,7 +1787,7 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface, ...@@ -1787,7 +1787,7 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface,
IDirect3DViewport3 *Direct3DViewport3) IDirect3DViewport3 *Direct3DViewport3)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice3(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport3(Direct3DViewport3); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport3(Direct3DViewport3);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport3); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport3);
...@@ -1830,7 +1830,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2 ...@@ -1830,7 +1830,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2
IDirect3DViewport2 *Direct3DViewport2) IDirect3DViewport2 *Direct3DViewport2)
{ {
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice2(iface);
IDirect3DViewportImpl *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2); struct d3d_viewport *vp = unsafe_impl_from_IDirect3DViewport2(Direct3DViewport2);
TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2); TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport2);
......
...@@ -69,7 +69,7 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) { ...@@ -69,7 +69,7 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) {
* *
*****************************************************************************/ *****************************************************************************/
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
IDirect3DDeviceImpl *lpDevice, IDirect3DViewportImpl *lpViewport) IDirect3DDeviceImpl *lpDevice, struct d3d_viewport *viewport)
{ {
/* DWORD bs = This->desc.dwBufferSize; */ /* DWORD bs = This->desc.dwBufferSize; */
DWORD vs = This->data.dwVertexOffset; DWORD vs = This->data.dwVertexOffset;
...@@ -79,15 +79,15 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -79,15 +79,15 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
char *instr = (char *)This->desc.lpData + is; char *instr = (char *)This->desc.lpData + is;
if (lpViewport->active_device != lpDevice) if (viewport->active_device != lpDevice)
{ {
WARN("Viewport %p active device is %p.\n", WARN("Viewport %p active device is %p.\n",
lpViewport, lpViewport->active_device); viewport, viewport->active_device);
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
/* Activate the viewport */ /* Activate the viewport */
viewport_activate(lpViewport, FALSE); viewport_activate(viewport, FALSE);
TRACE("ExecuteData :\n"); TRACE("ExecuteData :\n");
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
...@@ -376,8 +376,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -376,8 +376,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
unsigned int nb; unsigned int nb;
D3DVERTEX *src = ((LPD3DVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DVERTEX *src = ((LPD3DVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart;
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest;
D3DVIEWPORT *Viewport = &viewport->viewports.vp1;
D3DMATRIX mat; D3DMATRIX mat;
D3DVIEWPORT* Viewport = &lpViewport->viewports.vp1;
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
{ {
...@@ -421,8 +421,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -421,8 +421,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
unsigned int nb; unsigned int nb;
D3DLVERTEX *src = ((LPD3DLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DLVERTEX *src = ((LPD3DLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart;
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest;
D3DVIEWPORT *Viewport = &viewport->viewports.vp1;
D3DMATRIX mat; D3DMATRIX mat;
D3DVIEWPORT* Viewport = &lpViewport->viewports.vp1;
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment