#177 support 2 more clipper functions - GetClipList and SetClipList - clipping not supported yet in dd_blt!

This commit is contained in:
FunkyFr3sh 2022-09-27 13:56:36 +02:00
parent 73e13dbe8c
commit 24f6a020d5
4 changed files with 70 additions and 8 deletions

View file

@ -5,6 +5,42 @@
#include "debug.h"
HRESULT ddc_GetClipList(IDirectDrawClipperImpl* This, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSiz)
{
if (!This->region)
return DDERR_NOCLIPLIST;
if (!lpdwSiz)
return DDERR_INVALIDPARAMS;
HRGN region = NULL;
if (lpRect)
{
region = CreateRectRgnIndirect(lpRect);
if (!region)
return DDERR_INVALIDPARAMS;
if (CombineRgn(region, This->region, region, RGN_AND) == ERROR)
{
DeleteObject(region);
return DDERR_GENERIC;
}
}
else
{
region = This->region;
}
*lpdwSiz = GetRegionData(region, *lpdwSiz, lpClipList);
if (lpRect)
DeleteObject(region);
return DD_OK;
}
HRESULT ddc_GetHWnd(IDirectDrawClipperImpl* This, HWND FAR* lphWnd)
{
if (!lphWnd)
@ -15,6 +51,29 @@ HRESULT ddc_GetHWnd(IDirectDrawClipperImpl* This, HWND FAR* lphWnd)
return DD_OK;
}
HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags)
{
if (This->hwnd)
return DDERR_CLIPPERISUSINGHWND;
if (This->region)
DeleteObject(This->region);
if (lpClipList)
{
This->region = ExtCreateRegion(NULL, 0, lpClipList);
if (!This->region)
return DDERR_INVALIDCLIPLIST;
}
else
{
This->region = NULL;
}
return DD_OK;
}
HRESULT ddc_SetHWnd(IDirectDrawClipperImpl* This, DWORD dwFlags, HWND hWnd)
{
This->hwnd = hWnd;