1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

adjust clipper logging and make clipper less strict

This commit is contained in:
FunkyFr3sh 2024-05-28 00:33:05 +02:00
parent 9674705685
commit 94c718b5b1
4 changed files with 26 additions and 13 deletions

View File

@ -12,6 +12,7 @@ HRESULT ddc_GetHWnd(IDirectDrawClipperImpl* This, HWND FAR* lphWnd);
HRESULT ddc_IsClipListChanged(IDirectDrawClipperImpl* This, BOOL FAR* lpbChanged); HRESULT ddc_IsClipListChanged(IDirectDrawClipperImpl* This, BOOL FAR* lpbChanged);
HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags); HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags);
HRESULT ddc_SetHWnd(IDirectDrawClipperImpl* This, DWORD dwFlags, HWND hWnd); HRESULT ddc_SetHWnd(IDirectDrawClipperImpl* This, DWORD dwFlags, HWND hWnd);
HRESULT ddc_SetClipRect(IDirectDrawClipperImpl* This, LPRECT lpRect);
HRESULT dd_CreateClipper(DWORD dwFlags, IDirectDrawClipperImpl** lplpDDClipper, IUnknown FAR* pUnkOuter); HRESULT dd_CreateClipper(DWORD dwFlags, IDirectDrawClipperImpl** lplpDDClipper, IUnknown FAR* pUnkOuter);
#endif #endif

View File

@ -47,7 +47,7 @@ HRESULT __stdcall IDirectDrawClipper__GetClipList(
LPDWORD lpdwSiz) LPDWORD lpdwSiz)
{ {
TRACE( TRACE(
"NOT_IMPLEMENTED -> %s(This=%p, lpRect=%p, lpClipList=%p, lpdwSiz=%p)\n", "-> %s(This=%p, lpRect=%p, lpClipList=%p, lpdwSiz=%p)\n",
__FUNCTION__, __FUNCTION__,
This, This,
lpRect, lpRect,
@ -56,7 +56,7 @@ HRESULT __stdcall IDirectDrawClipper__GetClipList(
HRESULT ret = ddc_GetClipList(This, lpRect, lpClipList, lpdwSiz); HRESULT ret = ddc_GetClipList(This, lpRect, lpClipList, lpdwSiz);
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__); TRACE("<- %s\n", __FUNCTION__);
return ret; return ret;
} }
@ -86,9 +86,9 @@ HRESULT __stdcall IDirectDrawClipper__IsClipListChanged(IDirectDrawClipperImpl*
HRESULT __stdcall IDirectDrawClipper__SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags) HRESULT __stdcall IDirectDrawClipper__SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags)
{ {
TRACE("NOT_IMPLEMENTED -> %s(This=%p, lpClipList=%p, dwFlags=%08X)\n", __FUNCTION__, This, lpClipList, dwFlags); TRACE("-> %s(This=%p, lpClipList=%p, dwFlags=%08X)\n", __FUNCTION__, This, lpClipList, dwFlags);
HRESULT ret = ddc_SetClipList(This, lpClipList, dwFlags); HRESULT ret = ddc_SetClipList(This, lpClipList, dwFlags);
TRACE("NOT_IMPLEMENTED <- %s\n", __FUNCTION__); TRACE("<- %s\n", __FUNCTION__);
return ret; return ret;
} }

View File

@ -172,6 +172,19 @@ HRESULT ddc_SetHWnd(IDirectDrawClipperImpl* This, DWORD dwFlags, HWND hWnd)
return DD_OK; return DD_OK;
} }
HRESULT ddc_SetClipRect(IDirectDrawClipperImpl* This, LPRECT lpRect)
{
EnterCriticalSection(&This->cs);
if (This->region)
DeleteObject(This->region);
This->region = CreateRectRgnIndirect(lpRect);
LeaveCriticalSection(&This->cs);
return DD_OK;
}
HRESULT dd_CreateClipper(DWORD dwFlags, IDirectDrawClipperImpl** lplpDDClipper, IUnknown FAR* pUnkOuter) HRESULT dd_CreateClipper(DWORD dwFlags, IDirectDrawClipperImpl** lplpDDClipper, IUnknown FAR* pUnkOuter)
{ {
if (!lplpDDClipper) if (!lplpDDClipper)

View File

@ -11,6 +11,7 @@
#include "utils.h" #include "utils.h"
#include "blt.h" #include "blt.h"
#include "config.h" #include "config.h"
#include "ddclipper.h"
#include "versionhelpers.h" #include "versionhelpers.h"
@ -90,7 +91,7 @@ HRESULT dds_Blt(
{ {
DWORD size = 0; DWORD size = 0;
HRESULT result = IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, NULL, &size); HRESULT result = ddc_GetClipList(This->clipper, &dst_rect, NULL, &size);
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
@ -98,7 +99,7 @@ HRESULT dds_Blt(
if (list) if (list)
{ {
if (SUCCEEDED(IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, list, &size))) if (SUCCEEDED(ddc_GetClipList(This->clipper, &dst_rect, list, &size)))
{ {
RECT* dst_c_rect = (RECT*)list->Buffer; RECT* dst_c_rect = (RECT*)list->Buffer;
@ -125,11 +126,13 @@ HRESULT dds_Blt(
} }
else if (result == DDERR_NOCLIPLIST) else if (result == DDERR_NOCLIPLIST)
{ {
return DDERR_NOCLIPLIST; TRACE(" DDERR_NOCLIPLIST\n");
//return DDERR_NOCLIPLIST;
} }
else else
{ {
return DDERR_INVALIDCLIPLIST; TRACE(" DDERR_INVALIDCLIPLIST\n");
//return DDERR_INVALIDCLIPLIST;
} }
} }
@ -1023,12 +1026,8 @@ HRESULT dds_SetClipper(IDirectDrawSurfaceImpl* This, IDirectDrawClipperImpl* lpC
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && lpClipper->hwnd) if ((This->caps & DDSCAPS_PRIMARYSURFACE) && lpClipper->hwnd)
{ {
if (lpClipper->region)
DeleteObject(lpClipper->region);
RECT rc = { 0, 0, This->width, This->height }; RECT rc = { 0, 0, This->width, This->height };
ddc_SetClipRect(lpClipper, &rc);
lpClipper->region = CreateRectRgnIndirect(&rc);
} }
} }