Hi Henry,
Maybe it's a bit late to ask this but what's the reasoning behind introducing the struct keyword ? And why removing use of This ? It's a common practise in all wine code.
Christian
Le 08/03/2012 20:27, Henri Verbeet a écrit :
dlls/ddraw/ddraw.c | 623 ++++++++++++++++++++++---------------------- dlls/ddraw/ddraw_private.h | 39 ++-- dlls/ddraw/device.c | 2 +- dlls/ddraw/light.c | 2 +- dlls/ddraw/main.c | 22 +- dlls/ddraw/material.c | 2 +- dlls/ddraw/palette.c | 2 +- dlls/ddraw/surface.c | 2 +- dlls/ddraw/vertexbuffer.c | 2 +- dlls/ddraw/viewport.c | 2 +- 10 files changed, 346 insertions(+), 352 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 25519d2..3d156eb 100644 --- a/dlls/ddraw/ddraw.chverbeet@codeweavers.com +++ b/dlls/ddraw/ddraw.c @@ -75,44 +75,44 @@ const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops = ddraw_null_wined3d_object_destroyed, };
-static inline IDirectDrawImpl *impl_from_IDirectDraw(IDirectDraw *iface) +static inline struct ddraw *impl_from_IDirectDraw(IDirectDraw *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirectDraw_iface); }
-static inline IDirectDrawImpl *impl_from_IDirectDraw2(IDirectDraw2 *iface) +static inline struct ddraw *impl_from_IDirectDraw2(IDirectDraw2 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw2_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirectDraw2_iface); }
-static inline IDirectDrawImpl *impl_from_IDirectDraw4(IDirectDraw4 *iface) +static inline struct ddraw *impl_from_IDirectDraw4(IDirectDraw4 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw4_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirectDraw4_iface); }
-static inline IDirectDrawImpl *impl_from_IDirectDraw7(IDirectDraw7 *iface) +static inline struct ddraw *impl_from_IDirectDraw7(IDirectDraw7 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw7_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirectDraw7_iface); }
-static inline IDirectDrawImpl *impl_from_IDirect3D(IDirect3D *iface) +static inline struct ddraw *impl_from_IDirect3D(IDirect3D *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirect3D_iface); }
-static inline IDirectDrawImpl *impl_from_IDirect3D2(IDirect3D2 *iface) +static inline struct ddraw *impl_from_IDirect3D2(IDirect3D2 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D2_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirect3D2_iface); }
-static inline IDirectDrawImpl *impl_from_IDirect3D3(IDirect3D3 *iface) +static inline struct ddraw *impl_from_IDirect3D3(IDirect3D3 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D3_iface);
- return CONTAINING_RECORD(iface, struct ddraw, IDirect3D3_iface); }
-static inline IDirectDrawImpl *impl_from_IDirect3D7(IDirect3D7 *iface) +static inline struct ddraw *impl_from_IDirect3D7(IDirect3D7 *iface) {
- return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D7_iface);
return CONTAINING_RECORD(iface, struct ddraw, IDirect3D7_iface); }
/*****************************************************************************
@@ -141,7 +141,7 @@ static inline IDirectDrawImpl *impl_from_IDirect3D7(IDirect3D7 *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, void **obj) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *This = impl_from_IDirectDraw7(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(refiid), obj);
@@ -248,65 +248,65 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid,
static HRESULT WINAPI ddraw4_QueryInterface(IDirectDraw4 *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI ddraw2_QueryInterface(IDirectDraw2 *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI ddraw1_QueryInterface(IDirectDraw *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI d3d7_QueryInterface(IDirect3D7 *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
struct ddraw *ddraw = impl_from_IDirect3D7(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI d3d3_QueryInterface(IDirect3D3 *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI d3d2_QueryInterface(IDirect3D2 *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
static HRESULT WINAPI d3d1_QueryInterface(IDirect3D *iface, REFIID riid, void **object) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
- return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
return ddraw7_QueryInterface(&ddraw->IDirectDraw7_iface, riid, object); }
/*****************************************************************************
@@ -318,7 +318,7 @@ static HRESULT WINAPI d3d1_QueryInterface(IDirect3D *iface, REFIID riid, void **
- versions have individual refcounts, but the IDirect3D interfaces do not.
- All interfaces are from one object, that means calling QueryInterface on an
- IDirectDraw7 interface for an IDirectDraw4 interface does not create a new
- IDirectDrawImpl object.
- ddraw object.
- That means all AddRef and Release implementations of IDirectDrawX work
- with their own counter, and IDirect3DX::AddRef thunk to IDirectDraw (1),
@@ -329,7 +329,7 @@ static HRESULT WINAPI d3d1_QueryInterface(IDirect3D *iface, REFIID riid, void ** *****************************************************************************/ static ULONG WINAPI ddraw7_AddRef(IDirectDraw7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *This = impl_from_IDirectDraw7(iface); ULONG ref = InterlockedIncrement(&This->ref7);
TRACE("%p increasing refcount to %u.\n", This, ref);
@@ -341,7 +341,7 @@ static ULONG WINAPI ddraw7_AddRef(IDirectDraw7 *iface)
static ULONG WINAPI ddraw4_AddRef(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *This = impl_from_IDirectDraw4(iface); ULONG ref = InterlockedIncrement(&This->ref4);
TRACE("%p increasing refcount to %u.\n", This, ref);
@@ -353,7 +353,7 @@ static ULONG WINAPI ddraw4_AddRef(IDirectDraw4 *iface)
static ULONG WINAPI ddraw2_AddRef(IDirectDraw2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *This = impl_from_IDirectDraw2(iface); ULONG ref = InterlockedIncrement(&This->ref2);
TRACE("%p increasing refcount to %u.\n", This, ref);
@@ -365,7 +365,7 @@ static ULONG WINAPI ddraw2_AddRef(IDirectDraw2 *iface)
static ULONG WINAPI ddraw1_AddRef(IDirectDraw *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *This = impl_from_IDirectDraw(iface); ULONG ref = InterlockedIncrement(&This->ref1);
TRACE("%p increasing refcount to %u.\n", This, ref);
@@ -377,7 +377,7 @@ static ULONG WINAPI ddraw1_AddRef(IDirectDraw *iface)
static ULONG WINAPI d3d7_AddRef(IDirect3D7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
struct ddraw *This = impl_from_IDirect3D7(iface);
TRACE("iface %p.\n", iface);
@@ -386,7 +386,7 @@ static ULONG WINAPI d3d7_AddRef(IDirect3D7 *iface)
static ULONG WINAPI d3d3_AddRef(IDirect3D3 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *This = impl_from_IDirect3D3(iface);
TRACE("iface %p.\n", iface);
@@ -395,7 +395,7 @@ static ULONG WINAPI d3d3_AddRef(IDirect3D3 *iface)
static ULONG WINAPI d3d2_AddRef(IDirect3D2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *This = impl_from_IDirect3D2(iface);
TRACE("iface %p.\n", iface);
@@ -404,14 +404,14 @@ static ULONG WINAPI d3d2_AddRef(IDirect3D2 *iface)
static ULONG WINAPI d3d1_AddRef(IDirect3D *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *This = impl_from_IDirect3D(iface);
TRACE("iface %p.\n", iface);
return ddraw1_AddRef(&This->IDirectDraw_iface); }
-void ddraw_destroy_swapchain(IDirectDrawImpl *ddraw) +void ddraw_destroy_swapchain(struct ddraw *ddraw) { TRACE("Destroying the swapchain.\n");
@@ -466,7 +466,7 @@ void ddraw_destroy_swapchain(IDirectDrawImpl *ddraw)
- This: DirectDraw object to destroy
*****************************************************************************/ -static void ddraw_destroy(IDirectDrawImpl *This) +static void ddraw_destroy(struct ddraw *This) { IDirectDraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, NULL, DDSCL_NORMAL); IDirectDraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); @@ -501,7 +501,7 @@ static void ddraw_destroy(IDirectDrawImpl *This) *****************************************************************************/ static ULONG WINAPI ddraw7_Release(IDirectDraw7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *This = impl_from_IDirectDraw7(iface); ULONG ref = InterlockedDecrement(&This->ref7);
TRACE("%p decreasing refcount to %u.\n", This, ref);
@@ -514,7 +514,7 @@ static ULONG WINAPI ddraw7_Release(IDirectDraw7 *iface)
static ULONG WINAPI ddraw4_Release(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *This = impl_from_IDirectDraw4(iface); ULONG ref = InterlockedDecrement(&This->ref4);
TRACE("%p decreasing refcount to %u.\n", This, ref);
@@ -527,7 +527,7 @@ static ULONG WINAPI ddraw4_Release(IDirectDraw4 *iface)
static ULONG WINAPI ddraw2_Release(IDirectDraw2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *This = impl_from_IDirectDraw2(iface); ULONG ref = InterlockedDecrement(&This->ref2);
TRACE("%p decreasing refcount to %u.\n", This, ref);
@@ -540,7 +540,7 @@ static ULONG WINAPI ddraw2_Release(IDirectDraw2 *iface)
static ULONG WINAPI ddraw1_Release(IDirectDraw *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *This = impl_from_IDirectDraw(iface); ULONG ref = InterlockedDecrement(&This->ref1);
TRACE("%p decreasing refcount to %u.\n", This, ref);
@@ -553,7 +553,7 @@ static ULONG WINAPI ddraw1_Release(IDirectDraw *iface)
static ULONG WINAPI d3d7_Release(IDirect3D7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
struct ddraw *This = impl_from_IDirect3D7(iface);
TRACE("iface %p.\n", iface);
@@ -562,7 +562,7 @@ static ULONG WINAPI d3d7_Release(IDirect3D7 *iface)
static ULONG WINAPI d3d3_Release(IDirect3D3 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *This = impl_from_IDirect3D3(iface);
TRACE("iface %p.\n", iface);
@@ -571,7 +571,7 @@ static ULONG WINAPI d3d3_Release(IDirect3D3 *iface)
static ULONG WINAPI d3d2_Release(IDirect3D2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *This = impl_from_IDirect3D2(iface);
TRACE("iface %p.\n", iface);
@@ -580,7 +580,7 @@ static ULONG WINAPI d3d2_Release(IDirect3D2 *iface)
static ULONG WINAPI d3d1_Release(IDirect3D *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *This = impl_from_IDirect3D(iface);
TRACE("iface %p.\n", iface);
@@ -591,7 +591,7 @@ static ULONG WINAPI d3d1_Release(IDirect3D *iface)
- IDirectDraw methods
*****************************************************************************/
-static HRESULT ddraw_set_focus_window(IDirectDrawImpl *ddraw, HWND window) +static HRESULT ddraw_set_focus_window(struct ddraw *ddraw, HWND window) { /* FIXME: This looks wrong, exclusive mode should imply a destination * window. */ @@ -609,7 +609,7 @@ static HRESULT ddraw_set_focus_window(IDirectDrawImpl *ddraw, HWND window) return DD_OK; }
-static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, +static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, struct wined3d_swapchain_desc *swapchain_desc) { HWND window = swapchain_desc->device_window; @@ -664,7 +664,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, return DD_OK; }
-static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL windowed) +static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL windowed) { struct wined3d_swapchain_desc swapchain_desc; struct wined3d_display_mode mode; @@ -758,7 +758,7 @@ static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL *****************************************************************************/ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, DWORD cooplevel) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *This = impl_from_IDirectDraw7(iface); struct wined3d_stateblock *stateblock; struct wined3d_surface *rt, *ds; BOOL restore_state = FALSE;
@@ -995,29 +995,29 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
static HRESULT WINAPI ddraw4_SetCooperativeLevel(IDirectDraw4 *iface, HWND window, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
- return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags);
return ddraw7_SetCooperativeLevel(&ddraw->IDirectDraw7_iface, window, flags); }
static HRESULT WINAPI ddraw2_SetCooperativeLevel(IDirectDraw2 *iface, HWND window, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
- return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags);
return ddraw7_SetCooperativeLevel(&ddraw->IDirectDraw7_iface, window, flags); }
static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
- return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags);
return ddraw7_SetCooperativeLevel(&ddraw->IDirectDraw7_iface, window, flags); }
/*****************************************************************************
@@ -1032,7 +1032,7 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window
- ddraw7_SetDisplayMode.
*****************************************************************************/ -static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD Height, +static HRESULT ddraw_set_display_mode(struct ddraw *ddraw, DWORD Width, DWORD Height, DWORD BPP, DWORD RefreshRate, DWORD Flags) { struct wined3d_display_mode mode; @@ -1131,7 +1131,7 @@ static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DWORD Height, DWORD BPP, DWORD RefreshRate, DWORD Flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, Width, Height, BPP, RefreshRate, Flags);
@@ -1143,38 +1143,38 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DW RefreshRate = force_refresh_rate; }
- return ddraw_set_display_mode(This, Width, Height, BPP, RefreshRate, Flags);
return ddraw_set_display_mode(ddraw, Width, Height, BPP, RefreshRate, Flags); }
static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags);
- return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags);
return ddraw7_SetDisplayMode(&ddraw->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags); }
static HRESULT WINAPI ddraw2_SetDisplayMode(IDirectDraw2 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags);
- return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags);
return ddraw7_SetDisplayMode(&ddraw->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags); }
static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWORD height, DWORD bpp) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, width %u, height %u, bpp %u.\n", iface, width, height, bpp);
- return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, 0, 0);
return ddraw7_SetDisplayMode(&ddraw->IDirectDraw7_iface, width, height, bpp, 0, 0); }
/*****************************************************************************
@@ -1200,38 +1200,38 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO *****************************************************************************/ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
TRACE("iface %p.\n", iface);
- return ddraw_set_display_mode(This, This->orig_width, This->orig_height, This->orig_bpp, 0, 0);
return ddraw_set_display_mode(ddraw, ddraw->orig_width, ddraw->orig_height, ddraw->orig_bpp, 0, 0); }
static HRESULT WINAPI ddraw4_RestoreDisplayMode(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface);
return ddraw7_RestoreDisplayMode(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw2_RestoreDisplayMode(IDirectDraw2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface);
return ddraw7_RestoreDisplayMode(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface);
return ddraw7_RestoreDisplayMode(&ddraw->IDirectDraw7_iface); }
/*****************************************************************************
@@ -1251,7 +1251,7 @@ static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); DDCAPS caps; WINED3DCAPS winecaps; HRESULT hr;
@@ -1260,9 +1260,9 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, DriverCaps, HELCaps);
/* One structure must be != NULL */
- if( (!DriverCaps)&& (!HELCaps) )
- if (!DriverCaps&& !HELCaps) {
ERR("(%p) Invalid params to ddraw7_GetCaps\n", This);
WARN("Invalid parameters.\n"); return DDERR_INVALIDPARAMS; }
@@ -1271,7 +1271,7 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD caps.dwSize = sizeof(caps);
wined3d_mutex_lock();
- hr = wined3d_device_get_device_caps(This->wined3d_device,&winecaps);
- hr = wined3d_device_get_device_caps(ddraw->wined3d_device,&winecaps); if (FAILED(hr)) { WARN("IWineD3DDevice::GetDeviceCaps failed\n");
@@ -1341,29 +1341,29 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
static HRESULT WINAPI ddraw4_GetCaps(IDirectDraw4 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
- return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps);
return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps); }
static HRESULT WINAPI ddraw2_GetCaps(IDirectDraw2 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
- return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps);
return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps); }
static HRESULT WINAPI ddraw1_GetCaps(IDirectDraw *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps);
- return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps);
return ddraw7_GetCaps(&ddraw->IDirectDraw7_iface, driver_caps, hel_caps); }
/*****************************************************************************
@@ -1384,29 +1384,29 @@ static HRESULT WINAPI ddraw7_Compact(IDirectDraw7 *iface)
static HRESULT WINAPI ddraw4_Compact(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_Compact(&This->IDirectDraw7_iface);
return ddraw7_Compact(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw2_Compact(IDirectDraw2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_Compact(&This->IDirectDraw7_iface);
return ddraw7_Compact(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_Compact(&This->IDirectDraw7_iface);
return ddraw7_Compact(&ddraw->IDirectDraw7_iface); }
/*****************************************************************************
@@ -1425,7 +1425,7 @@ static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 *DDSD) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); struct wined3d_display_mode mode; HRESULT hr; DWORD Size;
@@ -1442,10 +1442,10 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2
/* The necessary members of LPDDSURFACEDESC and LPDDSURFACEDESC2 are equal, * so one method can be used for all versions (Hopefully) */
- hr = wined3d_device_get_display_mode(This->wined3d_device, 0,&mode);
- hr = wined3d_device_get_display_mode(ddraw->wined3d_device, 0,&mode); if (FAILED(hr)) {
ERR(" (%p) IWineD3DDevice::GetDisplayMode returned %08x\n", This, hr);
ERR("Failed to get display mode, hr %#x.\n", hr); wined3d_mutex_unlock(); return hr; }
@@ -1476,31 +1476,31 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2
static HRESULT WINAPI ddraw4_GetDisplayMode(IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
- return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, surface_desc);
return ddraw7_GetDisplayMode(&ddraw->IDirectDraw7_iface, surface_desc); }
static HRESULT WINAPI ddraw2_GetDisplayMode(IDirectDraw2 *iface, DDSURFACEDESC *surface_desc) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
/* FIXME: Test sizes, properly convert surface_desc */
- return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc);
return ddraw7_GetDisplayMode(&ddraw->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc); }
static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *surface_desc) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, surface_desc %p.\n", iface, surface_desc);
/* FIXME: Test sizes, properly convert surface_desc */
- return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc);
return ddraw7_GetDisplayMode(&ddraw->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc); }
/*****************************************************************************
@@ -1522,7 +1522,7 @@ static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *s *****************************************************************************/ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes, DWORD *Codes) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); static const enum wined3d_format_id formats[] = { WINED3DFMT_YUY2, WINED3DFMT_UYVY, WINED3DFMT_YV12,
@@ -1535,13 +1535,13 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
TRACE("iface %p, codes_count %p, codes %p.\n", iface, NumCodes, Codes);
- wined3d_device_get_display_mode(This->wined3d_device, 0,&mode);
wined3d_device_get_display_mode(ddraw->wined3d_device, 0,&mode);
outsize = NumCodes&& Codes ? *NumCodes : 0;
for (i = 0; i< (sizeof(formats) / sizeof(formats[0])); ++i) {
hr = wined3d_check_device_format(This->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i], DefaultSurfaceType); if (SUCCEEDED(hr)) {
@@ -1560,29 +1560,29 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
static HRESULT WINAPI ddraw4_GetFourCCCodes(IDirectDraw4 *iface, DWORD *codes_count, DWORD *codes) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
- return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes);
return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes); }
static HRESULT WINAPI ddraw2_GetFourCCCodes(IDirectDraw2 *iface, DWORD *codes_count, DWORD *codes) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
- return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes);
return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes); }
static HRESULT WINAPI ddraw1_GetFourCCCodes(IDirectDraw *iface, DWORD *codes_count, DWORD *codes) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes);
- return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes);
return ddraw7_GetFourCCCodes(&ddraw->IDirectDraw7_iface, codes_count, codes); }
/*****************************************************************************
@@ -1612,29 +1612,29 @@ static HRESULT WINAPI ddraw7_GetMonitorFrequency(IDirectDraw7 *iface, DWORD *Fre
static HRESULT WINAPI ddraw4_GetMonitorFrequency(IDirectDraw4 *iface, DWORD *frequency) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, frequency %p.\n", iface, frequency);
- return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency);
return ddraw7_GetMonitorFrequency(&ddraw->IDirectDraw7_iface, frequency); }
static HRESULT WINAPI ddraw2_GetMonitorFrequency(IDirectDraw2 *iface, DWORD *frequency) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, frequency %p.\n", iface, frequency);
- return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency);
return ddraw7_GetMonitorFrequency(&ddraw->IDirectDraw7_iface, frequency); }
static HRESULT WINAPI ddraw1_GetMonitorFrequency(IDirectDraw *iface, DWORD *frequency) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, frequency %p.\n", iface, frequency);
- return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency);
return ddraw7_GetMonitorFrequency(&ddraw->IDirectDraw7_iface, frequency); }
/*****************************************************************************
@@ -1668,29 +1668,29 @@ static HRESULT WINAPI ddraw7_GetVerticalBlankStatus(IDirectDraw7 *iface, BOOL *s
static HRESULT WINAPI ddraw4_GetVerticalBlankStatus(IDirectDraw4 *iface, BOOL *status) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, status %p.\n", iface, status);
- return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status);
return ddraw7_GetVerticalBlankStatus(&ddraw->IDirectDraw7_iface, status); }
static HRESULT WINAPI ddraw2_GetVerticalBlankStatus(IDirectDraw2 *iface, BOOL *status) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, status %p.\n", iface, status);
- return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status);
return ddraw7_GetVerticalBlankStatus(&ddraw->IDirectDraw7_iface, status); }
static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *status) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, status %p.\n", iface, status);
- return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status);
return ddraw7_GetVerticalBlankStatus(&ddraw->IDirectDraw7_iface, status); }
/*****************************************************************************
@@ -1711,14 +1711,14 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *Caps, DWORD *total, DWORD *free) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface); HRESULT hr = DD_OK;
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, Caps, total, free);
- if(TRACE_ON(ddraw))
- if (TRACE_ON(ddraw)) {
TRACE("(%p) Asked for memory with description: ", This);
TRACE("Asked for memory with description: "); DDRAW_dump_DDSCAPS2(Caps); } wined3d_mutex_lock();
@@ -1735,12 +1735,12 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C }
if (free)
*free = wined3d_device_get_available_texture_mem(This->wined3d_device);
*free = wined3d_device_get_available_texture_mem(ddraw->wined3d_device); if (total) { struct wined3d_adapter_identifier desc = {0};
hr = wined3d_get_adapter_identifier(This->wined3d, WINED3DADAPTER_DEFAULT, 0,&desc);
hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0,&desc); *total = desc.video_memory; }
@@ -1752,23 +1752,23 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C static HRESULT WINAPI ddraw4_GetAvailableVidMem(IDirectDraw4 *iface, DDSCAPS2 *caps, DWORD *total, DWORD *free) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
- return ddraw7_GetAvailableVidMem(&This->IDirectDraw7_iface, caps, total, free);
return ddraw7_GetAvailableVidMem(&ddraw->IDirectDraw7_iface, caps, total, free); }
static HRESULT WINAPI ddraw2_GetAvailableVidMem(IDirectDraw2 *iface, DDSCAPS *caps, DWORD *total, DWORD *free) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface); DDSCAPS2 caps2;
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
DDRAW_Convert_DDSCAPS_1_To_2(caps,&caps2);
- return ddraw7_GetAvailableVidMem(&This->IDirectDraw7_iface,&caps2, total, free);
return ddraw7_GetAvailableVidMem(&ddraw->IDirectDraw7_iface,&caps2, total, free); }
/*****************************************************************************
@@ -1787,11 +1787,11 @@ static HRESULT WINAPI ddraw2_GetAvailableVidMem(IDirectDraw2 *iface, *****************************************************************************/ static HRESULT WINAPI ddraw7_Initialize(IDirectDraw7 *iface, GUID *guid) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
- if (This->initialized)
if (ddraw->initialized) return DDERR_ALREADYINITIALIZED;
/* FIXME: To properly take the GUID into account we should call
@@ -1799,35 +1799,35 @@ static HRESULT WINAPI ddraw7_Initialize(IDirectDraw7 *iface, GUID *guid) if (guid) FIXME("Ignoring guid %s.\n", debugstr_guid(guid));
- This->initialized = TRUE;
ddraw->initialized = TRUE; return DD_OK; }
static HRESULT WINAPI ddraw4_Initialize(IDirectDraw4 *iface, GUID *guid) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
- return ddraw7_Initialize(&This->IDirectDraw7_iface, guid);
return ddraw7_Initialize(&ddraw->IDirectDraw7_iface, guid); }
static HRESULT WINAPI ddraw2_Initialize(IDirectDraw2 *iface, GUID *guid) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
- return ddraw7_Initialize(&This->IDirectDraw7_iface, guid);
return ddraw7_Initialize(&ddraw->IDirectDraw7_iface, guid); }
static HRESULT WINAPI ddraw1_Initialize(IDirectDraw *iface, GUID *guid) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
- return ddraw7_Initialize(&This->IDirectDraw7_iface, guid);
return ddraw7_Initialize(&ddraw->IDirectDraw7_iface, guid); }
static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, REFIID riid)
@@ -1859,29 +1859,29 @@ static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface)
static HRESULT WINAPI ddraw4_FlipToGDISurface(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface);
return ddraw7_FlipToGDISurface(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw2_FlipToGDISurface(IDirectDraw2 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface);
return ddraw7_FlipToGDISurface(&ddraw->IDirectDraw7_iface); }
static HRESULT WINAPI ddraw1_FlipToGDISurface(IDirectDraw *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface);
return ddraw7_FlipToGDISurface(&ddraw->IDirectDraw7_iface); }
/*****************************************************************************
@@ -1923,29 +1923,29 @@ static HRESULT WINAPI ddraw7_WaitForVerticalBlank(IDirectDraw7 *iface, DWORD Fla
static HRESULT WINAPI ddraw4_WaitForVerticalBlank(IDirectDraw4 *iface, DWORD flags, HANDLE event) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
- return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event);
return ddraw7_WaitForVerticalBlank(&ddraw->IDirectDraw7_iface, flags, event); }
static HRESULT WINAPI ddraw2_WaitForVerticalBlank(IDirectDraw2 *iface, DWORD flags, HANDLE event) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
- return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event);
return ddraw7_WaitForVerticalBlank(&ddraw->IDirectDraw7_iface, flags, event); }
static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flags, HANDLE event) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event);
- return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event);
return ddraw7_WaitForVerticalBlank(&ddraw->IDirectDraw7_iface, flags, event); }
/*****************************************************************************
@@ -1962,7 +1962,7 @@ static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flag *****************************************************************************/ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); struct wined3d_display_mode mode; static DWORD cur_scanline; static BOOL hide = FALSE;
@@ -1977,7 +1977,7 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline) }
wined3d_mutex_lock();
- wined3d_device_get_display_mode(This->wined3d_device, 0,&mode);
wined3d_device_get_display_mode(ddraw->wined3d_device, 0,&mode); wined3d_mutex_unlock();
/* Fake the line sweeping of the monitor */
@@ -1992,29 +1992,29 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
static HRESULT WINAPI ddraw4_GetScanLine(IDirectDraw4 *iface, DWORD *line) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, line %p.\n", iface, line);
- return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line);
return ddraw7_GetScanLine(&ddraw->IDirectDraw7_iface, line); }
static HRESULT WINAPI ddraw2_GetScanLine(IDirectDraw2 *iface, DWORD *line) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, line %p.\n", iface, line);
- return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line);
return ddraw7_GetScanLine(&ddraw->IDirectDraw7_iface, line); }
static HRESULT WINAPI ddraw1_GetScanLine(IDirectDraw *iface, DWORD *line) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, line %p.\n", iface, line);
- return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line);
return ddraw7_GetScanLine(&ddraw->IDirectDraw7_iface, line); }
/*****************************************************************************
@@ -2038,11 +2038,11 @@ static HRESULT WINAPI ddraw7_TestCooperativeLevel(IDirectDraw7 *iface)
static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_TestCooperativeLevel(&This->IDirectDraw7_iface);
return ddraw7_TestCooperativeLevel(&ddraw->IDirectDraw7_iface); }
/*****************************************************************************
@@ -2061,13 +2061,13 @@ static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
TRACE("iface %p, surface %p.\n", iface, GDISurface);
wined3d_mutex_lock();
- if (!(*GDISurface =&This->primary->IDirectDrawSurface7_iface))
- if (!(*GDISurface =&ddraw->primary->IDirectDrawSurface7_iface)) { WARN("Primary not created yet.\n"); wined3d_mutex_unlock();
@@ -2082,14 +2082,14 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa
static HRESULT WINAPI ddraw4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurface4 **surface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *surface_impl; HRESULT hr;
TRACE("iface %p, surface %p.\n", iface, surface);
- hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface,&surface7);
- hr = ddraw7_GetGDISurface(&ddraw->IDirectDraw7_iface,&surface7); if (FAILED(hr)) { *surface = NULL;
@@ -2105,14 +2105,14 @@ static HRESULT WINAPI ddraw4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurfa
static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurface **surface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *surface_impl; HRESULT hr;
TRACE("iface %p, surface %p.\n", iface, surface);
- hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface,&surface7);
- hr = ddraw7_GetGDISurface(&ddraw->IDirectDraw7_iface,&surface7); if (FAILED(hr)) { *surface = NULL;
@@ -2128,14 +2128,14 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa
static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurface **surface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *surface_impl; HRESULT hr;
TRACE("iface %p, surface %p.\n", iface, surface);
- hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface,&surface7);
- hr = ddraw7_GetGDISurface(&ddraw->IDirectDraw7_iface,&surface7); if (FAILED(hr)) { *surface = NULL;
@@ -2185,7 +2185,7 @@ static HRESULT CALLBACK EnumDisplayModesCallbackThunk(DDSURFACEDESC2 *surface_de static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMMODESCALLBACK2 cb) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); struct wined3d_display_mode *enum_modes = NULL; struct wined3d_display_mode mode; unsigned int modenum, fmt;
@@ -2223,7 +2223,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, for(fmt = 0; fmt< (sizeof(checkFormatList) / sizeof(checkFormatList[0])); fmt++) { modenum = 0;
while (wined3d_enum_adapter_modes(This->wined3d, WINED3DADAPTER_DEFAULT,
while (wined3d_enum_adapter_modes(ddraw->wined3d, WINED3DADAPTER_DEFAULT, checkFormatList[fmt], modenum++,&mode) == WINED3D_OK) { PixelFormat_WineD3DtoDD(&pixelformat, mode.format_id);
@@ -2325,18 +2325,18 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_EnumDisplayModes(IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMMODESCALLBACK2 callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", iface, flags, surface_desc, context, callback);
- return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags, surface_desc, context, callback);
return ddraw7_EnumDisplayModes(&ddraw->IDirectDraw7_iface, flags, surface_desc, context, callback); }
static HRESULT WINAPI ddraw2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw2(iface); struct displaymodescallback_context cbcontext; DDSURFACEDESC2 surface_desc2;
@@ -2347,14 +2347,14 @@ static HRESULT WINAPI ddraw2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags, cbcontext.context = context;
if (surface_desc) DDSD_to_DDSD2(surface_desc,&surface_desc2);
- return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags,
return ddraw7_EnumDisplayModes(&ddraw->IDirectDraw7_iface, flags, surface_desc ?&surface_desc2 : NULL,&cbcontext, EnumDisplayModesCallbackThunk); }
static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw(iface); struct displaymodescallback_context cbcontext; DDSURFACEDESC2 surface_desc2;
@@ -2365,7 +2365,7 @@ static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags, cbcontext.context = context;
if (surface_desc) DDSD_to_DDSD2(surface_desc,&surface_desc2);
- return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags,
- return ddraw7_EnumDisplayModes(&ddraw->IDirectDraw7_iface, flags, surface_desc ?&surface_desc2 : NULL,&cbcontext, EnumDisplayModesCallbackThunk); }
@@ -2431,13 +2431,13 @@ static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface, static HRESULT WINAPI ddraw4_GetDeviceIdentifier(IDirectDraw4 *iface, DDDEVICEIDENTIFIER *identifier, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface); DDDEVICEIDENTIFIER2 identifier2; HRESULT hr;
TRACE("iface %p, identifier %p, flags %#x.\n", iface, identifier, flags);
- hr = ddraw7_GetDeviceIdentifier(&This->IDirectDraw7_iface,&identifier2, flags);
hr = ddraw7_GetDeviceIdentifier(&ddraw->IDirectDraw7_iface,&identifier2, flags); DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&identifier2, identifier);
return hr;
@@ -2460,7 +2460,7 @@ static HRESULT WINAPI ddraw4_GetDeviceIdentifier(IDirectDraw4 *iface, static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDirectDrawSurface7 **Surface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); struct wined3d_surface *wined3d_surface; HRESULT hr;
@@ -2468,7 +2468,7 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc,
if (!Surface) return E_INVALIDARG;
- hr = wined3d_device_get_surface_from_dc(This->wined3d_device, hdc,&wined3d_surface);
- hr = wined3d_device_get_surface_from_dc(ddraw->wined3d_device, hdc,&wined3d_surface); if (FAILED(hr)) { TRACE("No surface found for dc %p.\n", hdc);
@@ -2485,7 +2485,7 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, IDirectDrawSurface4 **surface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw4(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *surface_impl; HRESULT hr;
@@ -2494,7 +2494,7 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc,
if (!surface) return E_INVALIDARG;
- hr = ddraw7_GetSurfaceFromDC(&This->IDirectDraw7_iface, dc,&surface7);
- hr = ddraw7_GetSurfaceFromDC(&ddraw->IDirectDraw7_iface, dc,&surface7); if (FAILED(hr)) { *surface = NULL;
@@ -2534,11 +2534,11 @@ static HRESULT WINAPI ddraw7_RestoreAllSurfaces(IDirectDraw7 *iface)
static HRESULT WINAPI ddraw4_RestoreAllSurfaces(IDirectDraw4 *iface) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p.\n", iface);
- return ddraw7_RestoreAllSurfaces(&This->IDirectDraw7_iface);
return ddraw7_RestoreAllSurfaces(&ddraw->IDirectDraw7_iface); }
/*****************************************************************************
@@ -2596,17 +2596,17 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO
- DD_OK on success
*****************************************************************************/ -static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD, +static HRESULT ddraw_create_surface(struct ddraw *ddraw, DDSURFACEDESC2 *pDDSD, IDirectDrawSurfaceImpl **ppSurf, UINT level, UINT version) { HRESULT hr;
TRACE("ddraw %p, surface_desc %p, surface %p, level %u.\n",
This, pDDSD, ppSurf, level);
ddraw, pDDSD, ppSurf, level); if (TRACE_ON(ddraw)) {
TRACE(" (%p) Requesting surface desc :\n", This);
TRACE("Requesting surface desc:\n"); DDRAW_dump_surface_desc(pDDSD); }
@@ -2620,11 +2620,11 @@ static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD *ppSurf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawSurfaceImpl)); if(!*ppSurf) {
ERR("(%p) Error allocating memory for a surface\n", This);
ERR("Failed to allocate surface memory.\n"); return DDERR_OUTOFVIDEOMEMORY; }
- hr = ddraw_surface_init(*ppSurf, This, pDDSD, level, version);
- hr = ddraw_surface_init(*ppSurf, ddraw, pDDSD, level, version); if (FAILED(hr)) { WARN("Failed to initialize surface, hr %#x.\n", hr);
@@ -2633,7 +2633,7 @@ static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD }
/* Increase the surface counter, and attach the surface */
- list_add_head(&This->surface_list,&(*ppSurf)->surface_list_entry);
list_add_head(&ddraw->surface_list,&(*ppSurf)->surface_list_entry);
TRACE("Created surface %p.\n", *ppSurf);
@@ -2653,12 +2653,8 @@ static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD
creates an additional surface without the mipmapping flags
*****************************************************************************/ -static HRESULT -CreateAdditionalSurfaces(IDirectDrawImpl *This,
IDirectDrawSurfaceImpl *root,
UINT count,
DDSURFACEDESC2 DDSD,
BOOL CubeFaceRoot, UINT version)
+static HRESULT CreateAdditionalSurfaces(struct ddraw *ddraw, IDirectDrawSurfaceImpl *root,
{ UINT i, j, level = 0; HRESULT hr;UINT count, DDSURFACEDESC2 DDSD, BOOL CubeFaceRoot, UINT version)
@@ -2685,7 +2681,7 @@ CreateAdditionalSurfaces(IDirectDrawImpl *This, } CubeFaceRoot = FALSE;
hr = ddraw_create_surface(This,&DDSD,&object2, level, version);
hr = ddraw_create_surface(ddraw,&DDSD,&object2, level, version); if(hr != DD_OK) { return hr;
@@ -2791,7 +2787,7 @@ static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource
- DDERR_* if an error occurs
*****************************************************************************/ -static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD, +static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, IDirectDrawSurfaceImpl **Surf, IUnknown *UnkOuter, UINT version) { IDirectDrawSurfaceImpl *object = NULL; @@ -3109,7 +3105,7 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD, static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *surface_desc, IDirectDrawSurface7 **surface, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); IDirectDrawSurfaceImpl *impl; HRESULT hr;
@@ -3118,7 +3114,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
wined3d_mutex_lock();
- if (!(This->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE)))
- if (!(ddraw->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE))) { WARN("Cooperative level not set.\n"); wined3d_mutex_unlock();
@@ -3145,7 +3141,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 * return DDERR_INVALIDCAPS; }
- hr = CreateSurface(This, surface_desc,&impl, outer_unknown, 7);
- hr = CreateSurface(ddraw, surface_desc,&impl, outer_unknown, 7); wined3d_mutex_unlock(); if (FAILED(hr)) {
@@ -3163,7 +3159,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 * static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc, IDirectDrawSurface4 **surface, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw4(iface); IDirectDrawSurfaceImpl *impl; HRESULT hr;
@@ -3172,7 +3168,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
wined3d_mutex_lock();
- if (!(This->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE)))
- if (!(ddraw->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE))) { WARN("Cooperative level not set.\n"); wined3d_mutex_unlock();
@@ -3199,7 +3195,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, return DDERR_INVALIDCAPS; }
- hr = CreateSurface(This, surface_desc,&impl, outer_unknown, 4);
- hr = CreateSurface(ddraw, surface_desc,&impl, outer_unknown, 4); wined3d_mutex_unlock(); if (FAILED(hr)) {
@@ -3217,7 +3213,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw2(iface); IDirectDrawSurfaceImpl *impl; HRESULT hr; DDSURFACEDESC2 surface_desc2;
@@ -3227,7 +3223,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
wined3d_mutex_lock();
- if (!(This->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE)))
- if (!(ddraw->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE))) { WARN("Cooperative level not set.\n"); wined3d_mutex_unlock();
@@ -3255,7 +3251,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, return DDERR_INVALIDCAPS; }
- hr = CreateSurface(This,&surface_desc2,&impl, outer_unknown, 2);
- hr = CreateSurface(ddraw,&surface_desc2,&impl, outer_unknown, 2); wined3d_mutex_unlock(); if (FAILED(hr)) {
@@ -3272,7 +3268,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw(iface); IDirectDrawSurfaceImpl *impl; HRESULT hr; DDSURFACEDESC2 surface_desc2;
@@ -3282,7 +3278,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
wined3d_mutex_lock();
- if (!(This->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE)))
- if (!(ddraw->cooperative_level& (DDSCL_NORMAL | DDSCL_EXCLUSIVE))) { WARN("Cooperative level not set.\n"); wined3d_mutex_unlock();
@@ -3300,7 +3296,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, * primaries anyway. */ surface_desc->ddsCaps.dwCaps&= ~DDSCAPS_FRONTBUFFER; DDSD_to_DDSD2(surface_desc,&surface_desc2);
- hr = CreateSurface(This,&surface_desc2,&impl, outer_unknown, 1);
- hr = CreateSurface(ddraw,&surface_desc2,&impl, outer_unknown, 1); wined3d_mutex_unlock(); if (FAILED(hr)) {
@@ -3486,13 +3482,7 @@ static HRESULT CALLBACK EnumSurfacesCallbackThunk(IDirectDrawSurface7 *surface, static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMSURFACESCALLBACK7 Callback) {
- /* The surface enumeration is handled by WineDDraw,
* because it keeps track of all surfaces attached to
* it. The filtering is done by our callback function,
* because WineDDraw doesn't handle ddraw-like surface
* caps structures
*/
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); IDirectDrawSurfaceImpl *surf; BOOL all, nomatch; DDSURFACEDESC2 desc;
@@ -3510,7 +3500,7 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, wined3d_mutex_lock();
/* Use the _SAFE enumeration, the app may destroy enumerated surfaces */
- LIST_FOR_EACH_SAFE(entry, entry2,&This->surface_list)
- LIST_FOR_EACH_SAFE(entry, entry2,&ddraw->surface_list) { surf = LIST_ENTRY(entry, IDirectDrawSurfaceImpl, surface_list_entry);
@@ -3541,7 +3531,7 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMSURFACESCALLBACK2 callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface); struct surfacescallback2_context cbcontext;
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
@@ -3550,14 +3540,14 @@ static HRESULT WINAPI ddraw4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context;
- return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags, surface_desc,
return ddraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, flags, surface_desc, &cbcontext, EnumSurfacesCallback2Thunk); }
static HRESULT WINAPI ddraw2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw2(iface); struct surfacescallback_context cbcontext; DDSURFACEDESC2 surface_desc2;
@@ -3568,14 +3558,14 @@ static HRESULT WINAPI ddraw2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags, cbcontext.context = context;
if (surface_desc) DDSD_to_DDSD2(surface_desc,&surface_desc2);
- return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags,
return ddraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, flags, surface_desc ?&surface_desc2 : NULL,&cbcontext, EnumSurfacesCallbackThunk); }
static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw(iface); struct surfacescallback_context cbcontext; DDSURFACEDESC2 surface_desc2;
@@ -3586,7 +3576,7 @@ static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags, cbcontext.context = context;
if (surface_desc) DDSD_to_DDSD2(surface_desc,&surface_desc2);
- return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags,
- return ddraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, flags, surface_desc ?&surface_desc2 : NULL,&cbcontext, EnumSurfacesCallbackThunk); }
@@ -3659,34 +3649,34 @@ static HRESULT WINAPI ddraw7_CreateClipper(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_CreateClipper(IDirectDraw4 *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface);
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown);
- return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown);
return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown); }
static HRESULT WINAPI ddraw2_CreateClipper(IDirectDraw2 *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface);
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown);
- return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown);
return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown); }
static HRESULT WINAPI ddraw1_CreateClipper(IDirectDraw *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface);
TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown);
- return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown);
return ddraw7_CreateClipper(&ddraw->IDirectDraw7_iface, flags, clipper, outer_unknown); }
/*****************************************************************************
@@ -3709,7 +3699,7 @@ static HRESULT WINAPI ddraw1_CreateClipper(IDirectDraw *iface, static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, PALETTEENTRY *ColorTable, IDirectDrawPalette **Palette, IUnknown *pUnkOuter) {
- IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
- struct ddraw *ddraw = impl_from_IDirectDraw7(iface); IDirectDrawPaletteImpl *object; HRESULT hr;
@@ -3722,7 +3712,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, wined3d_mutex_lock();
/* The refcount test shows that a cooplevel is required for this */
- if(!This->cooperative_level)
- if (!ddraw->cooperative_level) { WARN("No cooperative level set, returning DDERR_NOCOOPERATIVELEVELSET\n"); wined3d_mutex_unlock();
@@ -3737,7 +3727,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, return E_OUTOFMEMORY; }
- hr = ddraw_palette_init(object, This, Flags, ColorTable);
- hr = ddraw_palette_init(object, ddraw, Flags, ColorTable); if (FAILED(hr)) { WARN("Failed to initialize palette, hr %#x.\n", hr);
@@ -3756,17 +3746,17 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface); HRESULT hr;
TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr)&& *palette) { IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
IDirectDraw7_Release(&This->IDirectDraw7_iface);
IDirectDraw7_Release(&ddraw->IDirectDraw7_iface); IDirectDraw4_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; }
@@ -3776,17 +3766,17 @@ static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, PAL static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface); HRESULT hr;
TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr)&& *palette) { IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
IDirectDraw7_Release(&This->IDirectDraw7_iface);
IDirectDraw7_Release(&ddraw->IDirectDraw7_iface); impl->ifaceToRelease = NULL; }
@@ -3796,17 +3786,17 @@ static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags, static HRESULT WINAPI ddraw1_CreatePalette(IDirectDraw *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface); HRESULT hr;
TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
- hr = ddraw7_CreatePalette(&ddraw->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr)&& *palette) { IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
IDirectDraw7_Release(&This->IDirectDraw7_iface);
IDirectDraw7_Release(&ddraw->IDirectDraw7_iface); impl->ifaceToRelease = NULL; }
@@ -3847,14 +3837,15 @@ static HRESULT WINAPI ddraw7_DuplicateSurface(IDirectDraw7 *iface, static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, IDirectDrawSurface4 *src, IDirectDrawSurface4 **dst) {
- IDirectDrawImpl *This = impl_from_IDirectDraw4(iface);
struct ddraw *ddraw = impl_from_IDirectDraw4(iface); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface4(src); IDirectDrawSurface7 *dst7; IDirectDrawSurfaceImpl *dst_impl; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
- hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
- hr = ddraw7_DuplicateSurface(&ddraw->IDirectDraw7_iface, src_impl ?&src_impl->IDirectDrawSurface7_iface : NULL,&dst7); if (FAILED(hr)) {
@@ -3872,14 +3863,15 @@ static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, IDirectDrawSu static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface, IDirectDrawSurface *src, IDirectDrawSurface **dst) {
- IDirectDrawImpl *This = impl_from_IDirectDraw2(iface);
struct ddraw *ddraw = impl_from_IDirectDraw2(iface); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src); IDirectDrawSurface7 *dst7; IDirectDrawSurfaceImpl *dst_impl; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
- hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
- hr = ddraw7_DuplicateSurface(&ddraw->IDirectDraw7_iface, src_impl ?&src_impl->IDirectDrawSurface7_iface : NULL,&dst7); if (FAILED(hr)) return hr;
@@ -3894,14 +3886,15 @@ static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface, static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSurface *src, IDirectDrawSurface **dst) {
- IDirectDrawImpl *This = impl_from_IDirectDraw(iface);
struct ddraw *ddraw = impl_from_IDirectDraw(iface); IDirectDrawSurfaceImpl *src_impl = unsafe_impl_from_IDirectDrawSurface(src); IDirectDrawSurface7 *dst7; IDirectDrawSurfaceImpl *dst_impl; HRESULT hr;
TRACE("iface %p, src %p, dst %p.\n", iface, src, dst);
- hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface,
- hr = ddraw7_DuplicateSurface(&ddraw->IDirectDraw7_iface, src_impl ?&src_impl->IDirectDrawSurface7_iface : NULL,&dst7); if (FAILED(hr)) return hr;
@@ -3929,7 +3922,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur *****************************************************************************/ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBACK7 callback, void *context) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
- struct ddraw *ddraw = impl_from_IDirect3D7(iface); D3DDEVICEDESC7 device_desc7; D3DDEVICEDESC device_desc1; HRESULT hr;
@@ -3942,7 +3935,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
wined3d_mutex_lock();
- hr = IDirect3DImpl_GetCaps(This->wined3d,&device_desc1,&device_desc7);
- hr = IDirect3DImpl_GetCaps(ddraw->wined3d,&device_desc1,&device_desc7); if (hr != D3D_OK) { wined3d_mutex_unlock();
@@ -3991,7 +3984,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA { static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and OpenGL";
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
- struct ddraw *ddraw = impl_from_IDirect3D3(iface); D3DDEVICEDESC device_desc1, hal_desc, hel_desc; D3DDEVICEDESC7 device_desc7; HRESULT hr;
@@ -4009,7 +4002,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
wined3d_mutex_lock();
- hr = IDirect3DImpl_GetCaps(This->wined3d,&device_desc1,&device_desc7);
- hr = IDirect3DImpl_GetCaps(ddraw->wined3d,&device_desc1,&device_desc7); if (hr != D3D_OK) { wined3d_mutex_unlock();
@@ -4035,7 +4028,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA * limitation flag), and it refuses all devices that have the perspective * flag set. This way it refuses the emulation device, and HAL devices * never have POW2 unset in d3d7 on windows. */
- if (This->d3dversion != 1)
- if (ddraw->d3dversion != 1) { static CHAR reference_description[] = "RGB Direct3D emulation";
@@ -4092,20 +4085,20 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
static HRESULT WINAPI d3d2_EnumDevices(IDirect3D2 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&This->IDirect3D3_iface, callback, context);
return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); }
static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface);
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&This->IDirect3D3_iface, callback, context);
return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); }
/*****************************************************************************
@@ -4132,7 +4125,7 @@ static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBAC static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface); IDirect3DLightImpl *object;
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
@@ -4146,7 +4139,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light return DDERR_OUTOFMEMORY; }
- d3d_light_init(object, This);
d3d_light_init(object, ddraw);
TRACE("Created light %p.\n", object); *light =&object->IDirect3DLight_iface;
@@ -4156,20 +4149,20 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
static HRESULT WINAPI d3d2_CreateLight(IDirect3D2 *iface, IDirect3DLight **light, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
- return d3d3_CreateLight(&This->IDirect3D3_iface, light, outer_unknown);
return d3d3_CreateLight(&ddraw->IDirect3D3_iface, light, outer_unknown); }
static HRESULT WINAPI d3d1_CreateLight(IDirect3D *iface, IDirect3DLight **light, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface);
TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown);
- return d3d3_CreateLight(&This->IDirect3D3_iface, light, outer_unknown);
return d3d3_CreateLight(&ddraw->IDirect3D3_iface, light, outer_unknown); }
/*****************************************************************************
@@ -4195,14 +4188,14 @@ static HRESULT WINAPI d3d1_CreateLight(IDirect3D *iface, IDirect3DLight **light, static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 **material, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface); IDirect3DMaterialImpl *object;
TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
if (outer_unknown) return CLASS_E_NOAGGREGATION;
- object = d3d_material_create(This);
- object = d3d_material_create(ddraw); if (!object) { ERR("Failed to allocate material memory.\n");
@@ -4218,12 +4211,12 @@ static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 static HRESULT WINAPI d3d2_CreateMaterial(IDirect3D2 *iface, IDirect3DMaterial2 **material, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface); IDirect3DMaterialImpl *object;
TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
- object = d3d_material_create(This);
- object = d3d_material_create(ddraw); if (!object) { ERR("Failed to allocate material memory.\n");
@@ -4239,12 +4232,12 @@ static HRESULT WINAPI d3d2_CreateMaterial(IDirect3D2 *iface, IDirect3DMaterial2 static HRESULT WINAPI d3d1_CreateMaterial(IDirect3D *iface, IDirect3DMaterial **material, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface); IDirect3DMaterialImpl *object;
TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown);
- object = d3d_material_create(This);
- object = d3d_material_create(ddraw); if (!object) { ERR("Failed to allocate material memory.\n");
@@ -4280,7 +4273,7 @@ static HRESULT WINAPI d3d1_CreateMaterial(IDirect3D *iface, IDirect3DMaterial ** static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 **viewport, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface); IDirect3DViewportImpl *object;
TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
@@ -4294,7 +4287,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 return DDERR_OUTOFMEMORY; }
- d3d_viewport_init(object, This);
d3d_viewport_init(object, ddraw);
TRACE("Created viewport %p.\n", object); *viewport =&object->IDirect3DViewport3_iface;
@@ -4304,21 +4297,21 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
static HRESULT WINAPI d3d2_CreateViewport(IDirect3D2 *iface, IDirect3DViewport2 **viewport, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
- return d3d3_CreateViewport(&This->IDirect3D3_iface, (IDirect3DViewport3 **)viewport,
return d3d3_CreateViewport(&ddraw->IDirect3D3_iface, (IDirect3DViewport3 **)viewport, outer_unknown); }
static HRESULT WINAPI d3d1_CreateViewport(IDirect3D *iface, IDirect3DViewport **viewport, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface);
TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown);
- return d3d3_CreateViewport(&This->IDirect3D3_iface, (IDirect3DViewport3 **)viewport,
- return d3d3_CreateViewport(&ddraw->IDirect3D3_iface, (IDirect3DViewport3 **)viewport, outer_unknown); }
@@ -4340,7 +4333,7 @@ static HRESULT WINAPI d3d1_CreateViewport(IDirect3D *iface, IDirect3DViewport ** *****************************************************************************/ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
- struct ddraw *ddraw = impl_from_IDirect3D3(iface); D3DDEVICEDESC7 desc7; D3DDEVICEDESC desc1; HRESULT hr;
@@ -4373,7 +4366,7 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd }
/* Get the caps */
- hr = IDirect3DImpl_GetCaps(This->wined3d,&desc1,&desc7);
hr = IDirect3DImpl_GetCaps(ddraw->wined3d,&desc1,&desc7); if (hr != D3D_OK) return hr;
/* Now return our own GUID */
@@ -4388,20 +4381,20 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
static HRESULT WINAPI d3d2_FindDevice(IDirect3D2 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr);
- return d3d3_FindDevice(&This->IDirect3D3_iface, fds, fdr);
return d3d3_FindDevice(&ddraw->IDirect3D3_iface, fds, fdr); }
static HRESULT WINAPI d3d1_FindDevice(IDirect3D *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) {
- IDirectDrawImpl *This = impl_from_IDirect3D(iface);
struct ddraw *ddraw = impl_from_IDirect3D(iface);
TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr);
- return d3d3_FindDevice(&This->IDirect3D3_iface, fds, fdr);
return d3d3_FindDevice(&ddraw->IDirect3D3_iface, fds, fdr); }
/*****************************************************************************
@@ -4429,7 +4422,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, IDirectDrawSurface7 *surface, IDirect3DDevice7 **device) { IDirectDrawSurfaceImpl *target = unsafe_impl_from_IDirectDrawSurface7(surface);
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
- struct ddraw *ddraw = impl_from_IDirect3D7(iface); IDirect3DDeviceImpl *object; HRESULT hr;
@@ -4450,7 +4443,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, return DDERR_NO3D; }
- if (This->d3ddevice)
- if (ddraw->d3ddevice) { FIXME("Only one Direct3D device per DirectDraw object supported.\n"); wined3d_mutex_unlock();
@@ -4465,7 +4458,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, return DDERR_OUTOFMEMORY; }
- hr = d3d_device_init(object, This, target);
- hr = d3d_device_init(object, ddraw, target); if (FAILED(hr)) { WARN("Failed to initialize device, hr %#x.\n", hr);
@@ -4485,7 +4478,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid, IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
- struct ddraw *ddraw = impl_from_IDirect3D3(iface); IDirectDrawSurfaceImpl *surface_impl = unsafe_impl_from_IDirectDrawSurface4(surface); IDirect3DDevice7 *device7; IDirect3DDeviceImpl *device_impl;
@@ -4496,7 +4489,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
if (outer_unknown) return CLASS_E_NOAGGREGATION;
- hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid,
- hr = d3d7_CreateDevice(&ddraw->IDirect3D7_iface, riid, surface_impl ?&surface_impl->IDirectDrawSurface7_iface : NULL, device ?&device7 : NULL); if (SUCCEEDED(hr)) {
@@ -4510,7 +4503,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid, static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid, IDirectDrawSurface *surface, IDirect3DDevice2 **device) {
- IDirectDrawImpl *This = impl_from_IDirect3D2(iface);
- struct ddraw *ddraw = impl_from_IDirect3D2(iface); IDirectDrawSurfaceImpl *surface_impl = unsafe_impl_from_IDirectDrawSurface(surface); IDirect3DDevice7 *device7; IDirect3DDeviceImpl *device_impl;
@@ -4519,7 +4512,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid, TRACE("iface %p, riid %s, surface %p, device %p.\n", iface, debugstr_guid(riid), surface, device);
- hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid,
- hr = d3d7_CreateDevice(&ddraw->IDirect3D7_iface, riid, surface_impl ?&surface_impl->IDirectDrawSurface7_iface : NULL, device ?&device7 : NULL); if (SUCCEEDED(hr)) {
@@ -4553,7 +4546,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid, static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer7 **vertex_buffer, DWORD flags) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
- struct ddraw *ddraw = impl_from_IDirect3D7(iface); IDirect3DVertexBufferImpl *object; HRESULT hr;
@@ -4562,7 +4555,7 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER
if (!vertex_buffer || !desc) return DDERR_INVALIDPARAMS;
- hr = d3d_vertex_buffer_create(&object, This, desc);
- hr = d3d_vertex_buffer_create(&object, ddraw, desc); if (hr == D3D_OK) { TRACE("Created vertex buffer %p.\n", object);
@@ -4577,7 +4570,7 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer **vertex_buffer, DWORD flags, IUnknown *outer_unknown) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
- struct ddraw *ddraw = impl_from_IDirect3D3(iface); IDirect3DVertexBufferImpl *object; HRESULT hr;
@@ -4589,7 +4582,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER if (!vertex_buffer || !desc) return DDERR_INVALIDPARAMS;
- hr = d3d_vertex_buffer_create(&object, This, desc);
- hr = d3d_vertex_buffer_create(&object, ddraw, desc); if (hr == D3D_OK) { TRACE("Created vertex buffer %p.\n", object);
@@ -4622,7 +4615,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
- struct ddraw *ddraw = impl_from_IDirect3D7(iface); struct wined3d_display_mode mode; enum wined3d_device_type type; unsigned int i;
@@ -4681,11 +4674,11 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device * not like that we'll have to find some workaround, like iterating over * all imaginable formats and collecting all the depth stencil formats we * can get. */
- hr = wined3d_device_get_display_mode(This->wined3d_device, 0,&mode);
hr = wined3d_device_get_display_mode(ddraw->wined3d_device, 0,&mode);
for (i = 0; i< (sizeof(formats) / sizeof(*formats)); ++i) {
hr = wined3d_check_device_format(This->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i], WINED3D_SURFACE_TYPE_OPENGL); if (SUCCEEDED(hr)) {
@@ -4710,7 +4703,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device * while others used dwZBufferBitDepth=32. In either case the pitch matches a 32 bits per * pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and * newer enumerate both versions, so we do the same(bug 22434) */
- hr = wined3d_check_device_format(This->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
- hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM, WINED3D_SURFACE_TYPE_OPENGL); if (SUCCEEDED(hr)) {
@@ -4733,12 +4726,12 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device static HRESULT WINAPI d3d3_EnumZBufferFormats(IDirect3D3 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface);
TRACE("iface %p, device_iid %s, callback %p, context %p.\n", iface, debugstr_guid(device_iid), callback, context);
- return d3d7_EnumZBufferFormats(&This->IDirect3D7_iface, device_iid, callback, context);
return d3d7_EnumZBufferFormats(&ddraw->IDirect3D7_iface, device_iid, callback, context); }
/*****************************************************************************
@@ -4755,13 +4748,13 @@ static HRESULT WINAPI d3d3_EnumZBufferFormats(IDirect3D3 *iface, REFCLSID device *****************************************************************************/ static HRESULT WINAPI d3d7_EvictManagedTextures(IDirect3D7 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D7(iface);
struct ddraw *ddraw = impl_from_IDirect3D7(iface);
TRACE("iface %p!\n", iface);
wined3d_mutex_lock();
- if (This->d3d_initialized)
wined3d_device_evict_managed_resources(This->wined3d_device);
if (ddraw->d3d_initialized)
wined3d_device_evict_managed_resources(ddraw->wined3d_device); wined3d_mutex_unlock(); return D3D_OK;
@@ -4769,11 +4762,11 @@ static HRESULT WINAPI d3d7_EvictManagedTextures(IDirect3D7 *iface)
static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface) {
- IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
struct ddraw *ddraw = impl_from_IDirect3D3(iface);
TRACE("iface %p.\n", iface);
- return d3d7_EvictManagedTextures(&This->IDirect3D7_iface);
return d3d7_EvictManagedTextures(&ddraw->IDirect3D7_iface); }
/*****************************************************************************
@@ -5297,7 +5290,7 @@ static const struct IDirect3DVtbl d3d1_vtbl =
- NULL in case of an error, the vertex declaration for the FVF otherwise.
*****************************************************************************/ -struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) +struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *This, DWORD fvf) { struct wined3d_vertex_declaration *pDecl = NULL; HRESULT hr; @@ -5348,9 +5341,9 @@ struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD return pDecl; }
-static inline struct IDirectDrawImpl *ddraw_from_device_parent(struct wined3d_device_parent *device_parent) +static inline struct ddraw *ddraw_from_device_parent(struct wined3d_device_parent *device_parent) {
- return CONTAINING_RECORD(device_parent, struct IDirectDrawImpl, device_parent);
return CONTAINING_RECORD(device_parent, struct ddraw, device_parent); }
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
@@ -5363,7 +5356,7 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
- wined3d mutex. */
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent) {
- struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
- struct ddraw *ddraw = ddraw_from_device_parent(device_parent); MONITORINFO monitor_info; HMONITOR monitor; BOOL ret;
@@ -5397,7 +5390,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent * void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface) {
- struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
- struct ddraw *ddraw = ddraw_from_device_parent(device_parent); IDirectDrawSurfaceImpl *surf = NULL; UINT i = 0; DDSCAPS2 searchcaps = ddraw->tex_root->surface_desc.ddsCaps;
@@ -5466,7 +5459,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
static void STDMETHODCALLTYPE ddraw_frontbuffer_destroyed(void *parent) {
- struct IDirectDrawImpl *ddraw = parent;
- struct ddraw *ddraw = parent; ddraw->wined3d_frontbuffer = NULL; }
@@ -5480,7 +5473,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par enum wined3d_multisample_type multisample_type, DWORD multisample_quality, BOOL lockable, struct wined3d_surface **surface) {
- struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
- struct ddraw *ddraw = ddraw_from_device_parent(device_parent); DWORD flags = 0; HRESULT hr;
@@ -5532,7 +5525,7 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent, struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain) {
- struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
struct ddraw *ddraw = ddraw_from_device_parent(device_parent); HRESULT hr;
TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent, desc, swapchain);
@@ -5562,7 +5555,7 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops = device_parent_create_swapchain, };
-HRESULT ddraw_init(IDirectDrawImpl *ddraw, enum wined3d_device_type device_type) +HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) { HRESULT hr; HDC hDC; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index c87c737..f1ec33d 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -41,7 +41,6 @@ extern const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops DECLSPEC extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
/* Typdef the interfaces */ -typedef struct IDirectDrawImpl IDirectDrawImpl; typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl; typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl; typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl; @@ -62,7 +61,7 @@ struct FvfToDecl struct wined3d_vertex_declaration *decl; };
-struct IDirectDrawImpl +struct ddraw { /* Interfaces */ IDirectDraw7 IDirectDraw7_iface; @@ -122,10 +121,10 @@ struct IDirectDrawImpl
#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
-HRESULT ddraw_init(IDirectDrawImpl *ddraw, enum wined3d_device_type device_type) DECLSPEC_HIDDEN; -void ddraw_destroy_swapchain(IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN; +HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) DECLSPEC_HIDDEN; +void ddraw_destroy_swapchain(struct ddraw *ddraw) DECLSPEC_HIDDEN;
-static inline void ddraw_set_swapchain_window(struct IDirectDrawImpl *ddraw, HWND window) +static inline void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window) { if (window == GetDesktopWindow()) window = NULL; @@ -135,7 +134,7 @@ static inline void ddraw_set_swapchain_window(struct IDirectDrawImpl *ddraw, HWN /* Utility functions */ void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_HIDDEN; void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN; -struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) DECLSPEC_HIDDEN; +struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN;
/* The default surface type */ extern enum wined3d_surface_type DefaultSurfaceType DECLSPEC_HIDDEN; @@ -162,7 +161,7 @@ struct IDirectDrawSurfaceImpl int version;
/* Connections to other Objects */
- IDirectDrawImpl *ddraw;
- struct ddraw *ddraw; struct wined3d_surface *wined3d_surface; struct wined3d_texture *wined3d_texture;
@@ -200,7 +199,7 @@ struct IDirectDrawSurfaceImpl };
HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN; -HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw, +HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, struct ddraw *ddraw, DDSURFACEDESC2 *desc, UINT mip_level, UINT version) DECLSPEC_HIDDEN; ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
@@ -288,7 +287,7 @@ struct IDirect3DDeviceImpl
/* Other object connections */ struct wined3d_device *wined3d_device;
- IDirectDrawImpl *ddraw;
- struct ddraw *ddraw; struct wined3d_buffer *indexbuffer; IDirectDrawSurfaceImpl *target;
@@ -321,7 +320,7 @@ struct IDirect3DDeviceImpl D3DMATRIXHANDLE world, proj, view; };
-HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, +HRESULT d3d_device_init(IDirect3DDeviceImpl *device, struct ddraw *ddraw, IDirectDrawSurfaceImpl *target) DECLSPEC_HIDDEN;
/* The IID */ @@ -392,7 +391,7 @@ static inline IDirectDrawPaletteImpl *impl_from_IDirectDrawPalette(IDirectDrawPa IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface) DECLSPEC_HIDDEN;
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
IDirectDrawImpl *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN;
struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN;
/* Helper structures */ struct object_creation_info
@@ -411,7 +410,7 @@ struct IDirect3DLightImpl LONG ref;
/* IDirect3DLight fields */
- IDirectDrawImpl *ddraw;
struct ddraw *ddraw;
/* If this light is active for one viewport, put the viewport here */ IDirect3DViewportImpl *active_viewport;
@@ -427,7 +426,7 @@ struct IDirect3DLightImpl /* Helper functions */ void light_activate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN; void light_deactivate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN; -void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN; +void d3d_light_init(IDirect3DLightImpl *light, struct ddraw *ddraw) DECLSPEC_HIDDEN; IDirect3DLightImpl *unsafe_impl_from_IDirect3DLight(IDirect3DLight *iface) DECLSPEC_HIDDEN;
/****************************************************************************** @@ -441,7 +440,7 @@ struct IDirect3DMaterialImpl LONG ref;
/* IDirect3DMaterial2 fields */
- IDirectDrawImpl *ddraw;
struct ddraw *ddraw; IDirect3DDeviceImpl *active_device;
D3DMATERIAL mat;
@@ -450,7 +449,7 @@ struct IDirect3DMaterialImpl
/* Helper functions */ void material_activate(IDirect3DMaterialImpl* This) DECLSPEC_HIDDEN; -IDirect3DMaterialImpl *d3d_material_create(IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN; +IDirect3DMaterialImpl *d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN;
/*****************************************************************************
- IDirect3DViewport - Wraps to D3D7
@@ -461,7 +460,7 @@ struct IDirect3DViewportImpl LONG ref;
/* IDirect3DViewport fields */
- IDirectDrawImpl *ddraw;
struct ddraw *ddraw;
/* If this viewport is active for one device, put the device here */ IDirect3DDeviceImpl *active_device;
@@ -490,7 +489,7 @@ IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *ifa
/* Helper functions */ void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) DECLSPEC_HIDDEN; -void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN; +void d3d_viewport_init(IDirect3DViewportImpl *viewport, struct ddraw *ddraw) DECLSPEC_HIDDEN;
/*****************************************************************************
- IDirect3DExecuteBuffer - Wraps to D3D7
@@ -500,7 +499,7 @@ struct IDirect3DExecuteBufferImpl IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface; LONG ref; /* IDirect3DExecuteBuffer fields */
- IDirectDrawImpl *ddraw;
struct ddraw *ddraw; IDirect3DDeviceImpl *d3ddev;
D3DEXECUTEBUFFERDESC desc;
@@ -537,14 +536,14 @@ struct IDirect3DVertexBufferImpl /*** WineD3D and ddraw links ***/ struct wined3d_buffer *wineD3DVertexBuffer; struct wined3d_vertex_declaration *wineD3DVertexDeclaration;
- IDirectDrawImpl *ddraw;
struct ddraw *ddraw;
/*** Storage for D3D7 specific things ***/ DWORD Caps; DWORD fvf; };
-HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, IDirectDrawImpl *ddraw, +HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc) DECLSPEC_HIDDEN; IDirect3DVertexBufferImpl *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface) DECLSPEC_HIDDEN; IDirect3DVertexBufferImpl *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface) DECLSPEC_HIDDEN; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 72c3801e..c044d53 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -7019,7 +7019,7 @@ enum wined3d_depth_buffer_type IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DD return WINED3D_ZB_TRUE; }
-HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDirectDrawSurfaceImpl *target) +HRESULT d3d_device_init(IDirect3DDeviceImpl *device, struct ddraw *ddraw, IDirectDrawSurfaceImpl *target) { static const D3DMATRIX ident = { diff --git a/dlls/ddraw/light.c b/dlls/ddraw/light.c index 172ac23..4eeebd4 100644 --- a/dlls/ddraw/light.c +++ b/dlls/ddraw/light.c @@ -276,7 +276,7 @@ static const struct IDirect3DLightVtbl d3d_light_vtbl = IDirect3DLightImpl_GetLight };
-void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw) +void d3d_light_init(IDirect3DLightImpl *light, struct ddraw *ddraw) { light->IDirect3DLight_iface.lpVtbl =&d3d_light_vtbl; light->ref = 1; diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index b1456d8..3c8c555 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -187,7 +187,7 @@ DDRAW_Create(const GUID *guid, REFIID iid) { enum wined3d_device_type device_type;
- IDirectDrawImpl *This;
struct ddraw *ddraw; HRESULT hr;
TRACE("driver_guid %s, ddraw %p, outer_unknown %p, interface_iid %s.\n",
@@ -220,25 +220,27 @@ DDRAW_Create(const GUID *guid, return CLASS_E_NOAGGREGATION;
/* DirectDraw creation comes here */
- This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
- if(!This)
- ddraw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ddraw));
- if (!ddraw) { ERR("Out of memory when creating DirectDraw\n"); return E_OUTOFMEMORY; }
- hr = ddraw_init(This, device_type);
- hr = ddraw_init(ddraw, device_type); if (FAILED(hr)) { WARN("Failed to initialize ddraw object, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, This);
HeapFree(GetProcessHeap(), 0, ddraw); return hr; }
- hr = IDirectDraw7_QueryInterface(&This->IDirectDraw7_iface, iid, DD);
- IDirectDraw7_Release(&This->IDirectDraw7_iface);
- if (SUCCEEDED(hr)) list_add_head(&global_ddraw_list,&This->ddraw_list_entry);
- else WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), This);
hr = IDirectDraw7_QueryInterface(&ddraw->IDirectDraw7_iface, iid, DD);
IDirectDraw7_Release(&ddraw->IDirectDraw7_iface);
if (SUCCEEDED(hr))
list_add_head(&global_ddraw_list,&ddraw->ddraw_list_entry);
else
WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), ddraw); return hr;
}
@@ -928,10 +930,10 @@ DllMain(HINSTANCE hInstDLL, /* We remove elements from this loop */ LIST_FOR_EACH_SAFE(entry, entry2,&global_ddraw_list) {
struct ddraw *ddraw = LIST_ENTRY(entry, struct ddraw, ddraw_list_entry); HRESULT hr; DDSURFACEDESC2 desc; int i;
IDirectDrawImpl *ddraw = LIST_ENTRY(entry, IDirectDrawImpl, ddraw_list_entry); WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1);
diff --git a/dlls/ddraw/material.c b/dlls/ddraw/material.c index 7b3b702..24b932f 100644 --- a/dlls/ddraw/material.c +++ b/dlls/ddraw/material.c @@ -506,7 +506,7 @@ static const struct IDirect3DMaterialVtbl d3d_material1_vtbl = IDirect3DMaterialImpl_Unreserve };
-IDirect3DMaterialImpl *d3d_material_create(IDirectDrawImpl *ddraw) +IDirect3DMaterialImpl *d3d_material_create(struct ddraw *ddraw) { IDirect3DMaterialImpl *material;
diff --git a/dlls/ddraw/palette.c b/dlls/ddraw/palette.c index cff59a6..1d66db3 100644 --- a/dlls/ddraw/palette.c +++ b/dlls/ddraw/palette.c @@ -269,7 +269,7 @@ IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette * }
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
IDirectDrawImpl *ddraw, DWORD flags, PALETTEENTRY *entries)
{ HRESULT hr;struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 10643f5..0a7bf63 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5503,7 +5503,7 @@ HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) levels, 0, format, pool, surface,&ddraw_texture_wined3d_parent_ops,&surface->wined3d_texture); }
-HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw, +HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, struct ddraw *ddraw, DDSURFACEDESC2 *desc, UINT mip_level, UINT version) { enum wined3d_pool pool = WINED3D_POOL_DEFAULT; diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c index fe39e01..d03d249 100644 --- a/dlls/ddraw/vertexbuffer.c +++ b/dlls/ddraw/vertexbuffer.c @@ -539,7 +539,7 @@ static const struct IDirect3DVertexBufferVtbl d3d_vertex_buffer1_vtbl = IDirect3DVertexBufferImpl_1_Optimize };
-HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, IDirectDrawImpl *ddraw, +HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc) { IDirect3DVertexBufferImpl *buffer; diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c index 1523ac6..8980378 100644 --- a/dlls/ddraw/viewport.c +++ b/dlls/ddraw/viewport.c @@ -1191,7 +1191,7 @@ IDirect3DViewportImpl *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *ifa return CONTAINING_RECORD(iface, IDirect3DViewportImpl, IDirect3DViewport3_iface); }
-void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw) +void d3d_viewport_init(IDirect3DViewportImpl *viewport, struct ddraw *ddraw) { viewport->IDirect3DViewport3_iface.lpVtbl =&d3d_viewport_vtbl; viewport->ref = 1;