wined3d: Remove COM from the clipper implementation.
This commit is contained in:
parent
708c43a2ef
commit
304d713860
|
@ -95,7 +95,7 @@ static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) {
|
|||
if (ref == 0)
|
||||
{
|
||||
EnterCriticalSection(&ddraw_cs);
|
||||
IWineD3DClipper_Release(This->wineD3DClipper);
|
||||
wined3d_clipper_decref(This->wineD3DClipper);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return 0;
|
||||
|
@ -127,9 +127,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd(
|
|||
TRACE("iface %p, flags %#x, window %p.\n", iface, dwFlags, hWnd);
|
||||
|
||||
EnterCriticalSection(&ddraw_cs);
|
||||
hr = IWineD3DClipper_SetHWnd(This->wineD3DClipper,
|
||||
dwFlags,
|
||||
hWnd);
|
||||
hr = wined3d_clipper_set_window(This->wineD3DClipper, dwFlags, hWnd);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
switch(hr)
|
||||
{
|
||||
|
@ -167,10 +165,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList(
|
|||
iface, wine_dbgstr_rect(lpRect), lpClipList, lpdwSize);
|
||||
|
||||
EnterCriticalSection(&ddraw_cs);
|
||||
hr = IWineD3DClipper_GetClipList(This->wineD3DClipper,
|
||||
lpRect,
|
||||
lpClipList,
|
||||
lpdwSize);
|
||||
hr = wined3d_clipper_get_clip_list(This->wineD3DClipper, lpRect, lpClipList, lpdwSize);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr;
|
||||
}
|
||||
|
@ -198,9 +193,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList(
|
|||
TRACE("iface %p, clip_list %p, flags %#x.\n", iface, lprgn, dwFlag);
|
||||
|
||||
EnterCriticalSection(&ddraw_cs);
|
||||
hr = IWineD3DClipper_SetClipList(This->wineD3DClipper,
|
||||
lprgn,
|
||||
dwFlag);
|
||||
hr = wined3d_clipper_set_clip_list(This->wineD3DClipper, lprgn, dwFlag);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr;
|
||||
}
|
||||
|
@ -225,8 +218,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd(
|
|||
TRACE("iface %p, window %p.\n", iface, hWndPtr);
|
||||
|
||||
EnterCriticalSection(&ddraw_cs);
|
||||
hr = IWineD3DClipper_GetHWnd(This->wineD3DClipper,
|
||||
hWndPtr);
|
||||
hr = wined3d_clipper_get_window(This->wineD3DClipper, hWndPtr);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr;
|
||||
}
|
||||
|
@ -307,7 +299,7 @@ HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper)
|
|||
{
|
||||
clipper->lpVtbl = &ddraw_clipper_vtbl;
|
||||
clipper->ref = 1;
|
||||
clipper->wineD3DClipper = WineDirect3DCreateClipper();
|
||||
clipper->wineD3DClipper = wined3d_clipper_create();
|
||||
if (!clipper->wineD3DClipper)
|
||||
{
|
||||
WARN("Failed to create wined3d clipper.\n");
|
||||
|
|
|
@ -2516,11 +2516,11 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
|
|||
{
|
||||
IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf;
|
||||
IDirectDrawImpl *This = surfImpl->ddraw;
|
||||
struct wined3d_clipper *clipper = NULL;
|
||||
IWineD3DSurface *wineD3DSurface;
|
||||
IWineD3DSwapChain *swapchain;
|
||||
void *parent;
|
||||
HRESULT hr;
|
||||
IWineD3DClipper *clipper = NULL;
|
||||
|
||||
WINED3DSURFACE_DESC Desc;
|
||||
enum wined3d_format_id Format;
|
||||
|
@ -2593,10 +2593,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
|
|||
|
||||
surfImpl->ImplType = This->ImplType;
|
||||
|
||||
if(clipper)
|
||||
{
|
||||
IWineD3DClipper_Release(clipper);
|
||||
}
|
||||
if (clipper)
|
||||
wined3d_clipper_decref(clipper);
|
||||
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ struct IDirectDrawClipperImpl
|
|||
const IDirectDrawClipperVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
IWineD3DClipper *wineD3DClipper;
|
||||
struct wined3d_clipper *wineD3DClipper;
|
||||
BOOL initialized;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,70 +28,51 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_QueryInterface(IWineD3DClipper *iface, REFIID riid, void **object)
|
||||
ULONG CDECL wined3d_clipper_incref(struct wined3d_clipper *clipper)
|
||||
{
|
||||
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
||||
ULONG refcount = InterlockedIncrement(&clipper->ref);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DClipper)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*object = iface;
|
||||
return S_OK;
|
||||
}
|
||||
TRACE("%p increasing refcount to %u.\n", clipper, refcount);
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
|
||||
*object = NULL;
|
||||
return E_NOINTERFACE;
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DClipperImpl_AddRef(IWineD3DClipper *iface )
|
||||
ULONG CDECL wined3d_clipper_decref(struct wined3d_clipper *clipper)
|
||||
{
|
||||
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
ULONG refcount = InterlockedDecrement(&clipper->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
|
||||
TRACE("%p decreasing refcount to %u.\n", clipper, refcount);
|
||||
|
||||
return ref;
|
||||
if (!refcount)
|
||||
HeapFree(GetProcessHeap(), 0, clipper);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DClipperImpl_Release(IWineD3DClipper *iface)
|
||||
HRESULT CDECL wined3d_clipper_set_window(struct wined3d_clipper *clipper, DWORD flags, HWND window)
|
||||
{
|
||||
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
TRACE("clipper %p, flags %#x, window %p.\n", clipper, flags, window);
|
||||
|
||||
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
|
||||
|
||||
if (!ref) HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_SetHwnd(IWineD3DClipper *iface, DWORD flags, HWND hWnd)
|
||||
{
|
||||
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
|
||||
|
||||
TRACE("iface %p, flags %#x, window %p.\n", iface, flags, hWnd);
|
||||
if (flags)
|
||||
{
|
||||
FIXME("flags %#x, not supported.\n", flags);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
This->hWnd = hWnd;
|
||||
clipper->hWnd = window;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, const RECT *Rect,
|
||||
RGNDATA *ClipList, DWORD *Size)
|
||||
HRESULT CDECL wined3d_clipper_get_clip_list(const struct wined3d_clipper *clipper, const RECT *rect,
|
||||
RGNDATA *clip_list, DWORD *clip_list_size)
|
||||
{
|
||||
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
|
||||
TRACE("(%p,%p,%p,%p)\n", This, Rect, ClipList, Size);
|
||||
TRACE("clipper %p, rect %s, clip_list %p, clip_list_size %p.\n",
|
||||
clipper, wine_dbgstr_rect(rect), clip_list, clip_list_size);
|
||||
|
||||
if (This->hWnd)
|
||||
if (clipper->hWnd)
|
||||
{
|
||||
HDC hDC = GetDCEx(This->hWnd, NULL, DCX_WINDOW);
|
||||
HDC hDC = GetDCEx(clipper->hWnd, NULL, DCX_WINDOW);
|
||||
if (hDC)
|
||||
{
|
||||
HRGN hRgn = CreateRectRgn(0,0,0,0);
|
||||
|
@ -101,55 +82,60 @@ static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, co
|
|||
{
|
||||
/* map region to screen coordinates */
|
||||
POINT org;
|
||||
GetDCOrgEx( hDC, &org );
|
||||
OffsetRgn( hRgn, org.x, org.y );
|
||||
GetDCOrgEx(hDC, &org);
|
||||
OffsetRgn(hRgn, org.x, org.y);
|
||||
}
|
||||
if (Rect)
|
||||
if (rect)
|
||||
{
|
||||
HRGN hRgnClip = CreateRectRgn(Rect->left, Rect->top,
|
||||
Rect->right, Rect->bottom);
|
||||
HRGN hRgnClip = CreateRectRgn(rect->left, rect->top,
|
||||
rect->right, rect->bottom);
|
||||
CombineRgn(hRgn, hRgn, hRgnClip, RGN_AND);
|
||||
DeleteObject(hRgnClip);
|
||||
}
|
||||
*Size = GetRegionData(hRgn, *Size, ClipList);
|
||||
*clip_list_size = GetRegionData(hRgn, *clip_list_size, clip_list);
|
||||
}
|
||||
DeleteObject(hRgn);
|
||||
ReleaseDC(This->hWnd, hDC);
|
||||
ReleaseDC(clipper->hWnd, hDC);
|
||||
}
|
||||
return WINED3D_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
static int warned = 0;
|
||||
if (warned++ < 10)
|
||||
FIXME("(%p,%p,%p,%p),stub!\n",This,Rect,ClipList,Size);
|
||||
if (Size) *Size=0;
|
||||
static unsigned int once;
|
||||
|
||||
if (!once++)
|
||||
FIXME("clipper %p, rect %s, clip_list %p, clip_list_size %p stub!\n",
|
||||
clipper, wine_dbgstr_rect(rect), clip_list, clip_list_size);
|
||||
|
||||
if (clip_list_size)
|
||||
*clip_list_size = 0;
|
||||
|
||||
return WINEDDERR_NOCLIPLIST;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_SetClipList(IWineD3DClipper *iface, const RGNDATA *rgn, DWORD flags)
|
||||
HRESULT CDECL wined3d_clipper_set_clip_list(struct wined3d_clipper *clipper, const RGNDATA *region, DWORD flags)
|
||||
{
|
||||
static int warned = 0;
|
||||
static unsigned int once;
|
||||
|
||||
if (warned++ < 10 || !rgn)
|
||||
FIXME("iface %p, region %p, flags %#x stub!\n", iface, rgn, flags);
|
||||
if (!once++ || !region)
|
||||
FIXME("clipper %p, region %p, flags %#x stub!\n", clipper, region, flags);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_GetHwnd(IWineD3DClipper *iface, HWND *hwnd)
|
||||
HRESULT CDECL wined3d_clipper_get_window(const struct wined3d_clipper *clipper, HWND *window)
|
||||
{
|
||||
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
|
||||
TRACE("(%p)->(%p)\n", This, hwnd);
|
||||
TRACE("clipper %p, window %p.\n", clipper, window);
|
||||
|
||||
*window = clipper->hWnd;
|
||||
|
||||
*hwnd = This->hWnd;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DClipperImpl_IsClipListChanged(IWineD3DClipper *iface, BOOL *changed)
|
||||
HRESULT CDECL wined3d_clipper_is_clip_list_changed(const struct wined3d_clipper *clipper, BOOL *changed)
|
||||
{
|
||||
FIXME("iface %p, changed %p stub!\n", iface, changed);
|
||||
FIXME("clipper %p, changed %p stub!\n", clipper, changed);
|
||||
|
||||
/* XXX What is safest? */
|
||||
*changed = FALSE;
|
||||
|
@ -157,19 +143,7 @@ static HRESULT WINAPI IWineD3DClipperImpl_IsClipListChanged(IWineD3DClipper *ifa
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static const IWineD3DClipperVtbl IWineD3DClipper_Vtbl =
|
||||
{
|
||||
IWineD3DClipperImpl_QueryInterface,
|
||||
IWineD3DClipperImpl_AddRef,
|
||||
IWineD3DClipperImpl_Release,
|
||||
IWineD3DClipperImpl_GetClipList,
|
||||
IWineD3DClipperImpl_GetHwnd,
|
||||
IWineD3DClipperImpl_IsClipListChanged,
|
||||
IWineD3DClipperImpl_SetClipList,
|
||||
IWineD3DClipperImpl_SetHwnd
|
||||
};
|
||||
|
||||
IWineD3DClipper * WINAPI WineDirect3DCreateClipper(void)
|
||||
struct wined3d_clipper * CDECL wined3d_clipper_create(void)
|
||||
{
|
||||
IWineD3DClipperImpl *obj;
|
||||
|
||||
|
@ -182,8 +156,6 @@ IWineD3DClipper * WINAPI WineDirect3DCreateClipper(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
obj->lpVtbl = &IWineD3DClipper_Vtbl;
|
||||
|
||||
IWineD3DClipper_AddRef((IWineD3DClipper *)obj);
|
||||
wined3d_clipper_incref(obj);
|
||||
return (IWineD3DClipper *) obj;
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD
|
|||
|
||||
*clipper = (IWineD3DClipper *)This->clipper;
|
||||
if (*clipper)
|
||||
IWineD3DClipper_AddRef(*clipper);
|
||||
wined3d_clipper_incref(*clipper);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
@ stdcall WineDirect3DCreateClipper()
|
||||
@ stdcall wined3d_mutex_lock()
|
||||
@ stdcall wined3d_mutex_unlock()
|
||||
|
||||
|
@ -20,6 +19,15 @@
|
|||
@ cdecl wined3d_incref(ptr)
|
||||
@ cdecl wined3d_register_software_device(ptr ptr)
|
||||
|
||||
@ cdecl wined3d_clipper_create()
|
||||
@ cdecl wined3d_clipper_decref(ptr)
|
||||
@ cdecl wined3d_clipper_get_clip_list(ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_clipper_get_window(ptr ptr)
|
||||
@ cdecl wined3d_clipper_incref(ptr)
|
||||
@ cdecl wined3d_clipper_is_clip_list_changed(ptr ptr)
|
||||
@ cdecl wined3d_clipper_set_clip_list(ptr ptr long)
|
||||
@ cdecl wined3d_clipper_set_window(ptr long ptr)
|
||||
|
||||
@ cdecl wined3d_device_create(ptr long long ptr long ptr ptr)
|
||||
|
||||
@ cdecl wined3d_palette_decref(ptr)
|
||||
|
|
|
@ -58,6 +58,8 @@ typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl;
|
|||
struct IWineD3DBaseShaderImpl;
|
||||
struct IWineD3DBaseTextureImpl;
|
||||
struct IWineD3DResourceImpl;
|
||||
typedef struct wined3d_clipper IWineD3DClipperImpl;
|
||||
typedef struct wined3d_clipper IWineD3DClipper;
|
||||
|
||||
/* Texture format fixups */
|
||||
|
||||
|
@ -2049,16 +2051,12 @@ struct fbo_entry
|
|||
GLuint id;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DClipp implementation structure
|
||||
*/
|
||||
typedef struct IWineD3DClipperImpl
|
||||
struct wined3d_clipper
|
||||
{
|
||||
const IWineD3DClipperVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
HWND hWnd;
|
||||
} IWineD3DClipperImpl;
|
||||
};
|
||||
|
||||
enum wined3d_container_type
|
||||
{
|
||||
|
@ -2138,7 +2136,7 @@ struct IWineD3DSurfaceImpl
|
|||
SIZE ds_current_size;
|
||||
|
||||
/* DirectDraw clippers */
|
||||
struct IWineD3DClipperImpl *clipper;
|
||||
struct wined3d_clipper *clipper;
|
||||
|
||||
/* DirectDraw Overlay handling */
|
||||
RECT overlay_srcrect;
|
||||
|
|
|
@ -2111,6 +2111,7 @@ interface IWineD3DVolume;
|
|||
interface IWineD3DSwapChain;
|
||||
interface IWineD3DDevice;
|
||||
struct wined3d;
|
||||
struct wined3d_clipper;
|
||||
struct wined3d_palette;
|
||||
struct wined3d_stateblock;
|
||||
struct wined3d_vertex_declaration;
|
||||
|
@ -2235,34 +2236,6 @@ interface IWineD3DRendertargetView : IWineD3DBase
|
|||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(8f2bceb1-d338-488c-ab7f-0ec980bf5d2d)
|
||||
]
|
||||
interface IWineD3DClipper : IUnknown
|
||||
{
|
||||
HRESULT GetClipList(
|
||||
[in] const RECT *rect,
|
||||
[out] RGNDATA *clip_list,
|
||||
[in, out] DWORD *clip_list_size
|
||||
);
|
||||
HRESULT GetHWnd(
|
||||
[out] HWND *hwnd
|
||||
);
|
||||
HRESULT IsClipListChanged(
|
||||
[out] BOOL *changed
|
||||
);
|
||||
HRESULT SetClipList(
|
||||
[in] const RGNDATA *clip_list,
|
||||
[in] DWORD flags
|
||||
);
|
||||
HRESULT SetHWnd(
|
||||
[in] DWORD flags,
|
||||
[in] HWND hwnd
|
||||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
|
@ -2350,10 +2323,10 @@ interface IWineD3DSurface : IWineD3DResource
|
|||
[in] const WINEDDOVERLAYFX *fx
|
||||
);
|
||||
HRESULT SetClipper(
|
||||
[in] IWineD3DClipper *clipper
|
||||
[in] struct wined3d_clipper *clipper
|
||||
);
|
||||
HRESULT GetClipper(
|
||||
[out] IWineD3DClipper **clipper
|
||||
[out] struct wined3d_clipper **clipper
|
||||
);
|
||||
HRESULT SetFormat(
|
||||
[in] enum wined3d_format_id format_id
|
||||
|
@ -3233,7 +3206,6 @@ interface IWineD3DDevice : IUnknown
|
|||
);
|
||||
}
|
||||
|
||||
IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void);
|
||||
void __stdcall wined3d_mutex_lock(void);
|
||||
void __stdcall wined3d_mutex_unlock(void);
|
||||
|
||||
|
@ -3271,6 +3243,16 @@ void * __cdecl wined3d_get_parent(const struct wined3d *wined3d);
|
|||
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
|
||||
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
|
||||
|
||||
struct wined3d_clipper * __cdecl wined3d_clipper_create(void);
|
||||
ULONG __cdecl wined3d_clipper_decref(struct wined3d_clipper *clipper);
|
||||
HRESULT __cdecl wined3d_clipper_get_clip_list(const struct wined3d_clipper *clipper,
|
||||
const RECT *rect, RGNDATA *clip_list, DWORD *clip_list_size);
|
||||
HRESULT __cdecl wined3d_clipper_get_window(const struct wined3d_clipper *clipper, HWND *hwnd);
|
||||
ULONG __cdecl wined3d_clipper_incref(struct wined3d_clipper *clipper);
|
||||
HRESULT __cdecl wined3d_clipper_is_clip_list_changed(const struct wined3d_clipper *clipper, BOOL *changed);
|
||||
HRESULT __cdecl wined3d_clipper_set_clip_list(struct wined3d_clipper *clipper, const RGNDATA *clip_list, DWORD flags);
|
||||
HRESULT __cdecl wined3d_clipper_set_window(struct wined3d_clipper *clipper, DWORD flags, HWND hwnd);
|
||||
|
||||
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
|
||||
WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags,
|
||||
IWineD3DDeviceParent *device_parent, IWineD3DDevice **device);
|
||||
|
|
Loading…
Reference in New Issue