[PATCH 1/3] ddraw: Pass This instead of iface pointers to internal functions.
Michael Stefaniuc
mstefani at redhat.de
Mon Jan 17 18:30:36 CST 2011
---
dlls/ddraw/ddraw.c | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index c0354ce..4d6cb2e 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -762,15 +762,14 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window
* ddraw7_SetDisplayMode.
*
*****************************************************************************/
-static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD Height,
+static HRESULT ddraw_set_display_mode(IDirectDrawImpl *This, DWORD Width, DWORD Height,
DWORD BPP, DWORD RefreshRate, DWORD Flags)
{
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
WINED3DDISPLAYMODE Mode;
HRESULT hr;
- TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
- iface, Width, Height, BPP, RefreshRate, Flags);
+ TRACE("This %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
+ This, Width, Height, BPP, RefreshRate, Flags);
EnterCriticalSection(&ddraw_cs);
if( !Width || !Height )
@@ -846,6 +845,8 @@ static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD He
static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DWORD Height,
DWORD BPP, DWORD RefreshRate, DWORD Flags)
{
+ IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+
TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n",
iface, Width, Height, BPP, RefreshRate, Flags);
@@ -856,7 +857,7 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DW
RefreshRate = force_refresh_rate;
}
- return ddraw_set_display_mode(iface, Width, Height, BPP, RefreshRate, Flags);
+ return ddraw_set_display_mode(This, Width, Height, BPP, RefreshRate, Flags);
}
static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface,
@@ -923,7 +924,7 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
TRACE("iface %p.\n", iface);
- return ddraw_set_display_mode(iface, This->orig_width, This->orig_height, This->orig_bpp, 0, 0);
+ return ddraw_set_display_mode(This, This->orig_width, This->orig_height, This->orig_bpp, 0, 0);
}
static HRESULT WINAPI ddraw4_RestoreDisplayMode(IDirectDraw4 *iface)
@@ -2867,10 +2868,9 @@ static HRESULT ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur
* DDERR_* if an error occurs
*
*****************************************************************************/
-static HRESULT CreateSurface(IDirectDraw7 *iface,
- DDSURFACEDESC2 *DDSD, IDirectDrawSurface7 **Surf, IUnknown *UnkOuter)
+static HRESULT CreateSurface(IDirectDrawImpl *This, DDSURFACEDESC2 *DDSD,
+ IDirectDrawSurface7 **Surf, IUnknown *UnkOuter)
{
- IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
IDirectDrawSurfaceImpl *object = NULL;
HRESULT hr;
LONG extra_surfaces = 0;
@@ -2878,8 +2878,7 @@ static HRESULT CreateSurface(IDirectDraw7 *iface,
WINED3DDISPLAYMODE Mode;
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
- TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
- iface, DDSD, Surf, UnkOuter);
+ TRACE("This %p, surface_desc %p, surface %p, outer_unknown %p.\n", This, DDSD, Surf, UnkOuter);
/* Some checks before we start */
if (TRACE_ON(ddraw))
@@ -3244,8 +3243,8 @@ static HRESULT CreateSurface(IDirectDraw7 *iface,
}
/* Addref the ddraw interface to keep an reference for each surface */
- IDirectDraw7_AddRef(iface);
- object->ifaceToRelease = (IUnknown *) iface;
+ IDirectDraw7_AddRef((IDirectDraw7 *)This);
+ object->ifaceToRelease = (IUnknown *)This;
/* Create a WineD3DTexture if a texture was requested */
if(desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
@@ -3302,6 +3301,8 @@ static HRESULT CreateSurface(IDirectDraw7 *iface,
static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
DDSURFACEDESC2 *surface_desc, IDirectDrawSurface7 **surface, IUnknown *outer_unknown)
{
+ IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+
TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
iface, surface_desc, surface, outer_unknown);
@@ -3323,7 +3324,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
return DDERR_INVALIDCAPS;
}
- return CreateSurface(iface, surface_desc, surface, outer_unknown);
+ return CreateSurface(This, surface_desc, surface, outer_unknown);
}
static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
@@ -3354,7 +3355,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
return DDERR_INVALIDCAPS;
}
- hr = CreateSurface((IDirectDraw7 *)ddraw, surface_desc, (IDirectDrawSurface7 **)surface, outer_unknown);
+ hr = CreateSurface(ddraw, surface_desc, (IDirectDrawSurface7 **)surface, outer_unknown);
impl = (IDirectDrawSurfaceImpl *)*surface;
if (SUCCEEDED(hr) && impl)
{
@@ -3396,7 +3397,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface,
return DDERR_INVALIDCAPS;
}
- hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
+ hr = CreateSurface(ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
if (FAILED(hr))
{
*surface = NULL;
@@ -3442,7 +3443,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
return DDERR_INVALIDCAPS;
}
- hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
+ hr = CreateSurface(ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
if (FAILED(hr))
{
*surface = NULL;
@@ -3478,7 +3479,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
/* Remove front buffer flag, this causes failure in v7, and its added to normal
* primaries anyway. */
surface_desc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
- hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
+ hr = CreateSurface(ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown);
if (FAILED(hr))
{
*surface = NULL;
--
1.7.3.4
More information about the wine-patches
mailing list