improve error checks
This commit is contained in:
parent
5bbe1299d2
commit
63033840d9
1 changed files with 11 additions and 5 deletions
|
@ -69,11 +69,14 @@ HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWOR
|
||||||
if (This->hwnd)
|
if (This->hwnd)
|
||||||
return DDERR_CLIPPERISUSINGHWND;
|
return DDERR_CLIPPERISUSINGHWND;
|
||||||
|
|
||||||
if (This->region)
|
if (lpClipList)
|
||||||
DeleteObject(This->region);
|
|
||||||
|
|
||||||
if (lpClipList && lpClipList->rdh.nCount >= 1)
|
|
||||||
{
|
{
|
||||||
|
if (!lpClipList->rdh.nCount)
|
||||||
|
return DDERR_INVALIDCLIPLIST;
|
||||||
|
|
||||||
|
if (This->region)
|
||||||
|
DeleteObject(This->region);
|
||||||
|
|
||||||
RECT* rc = (RECT*)lpClipList->Buffer;
|
RECT* rc = (RECT*)lpClipList->Buffer;
|
||||||
|
|
||||||
This->region = CreateRectRgnIndirect(&rc[0]);
|
This->region = CreateRectRgnIndirect(&rc[0]);
|
||||||
|
@ -88,7 +91,7 @@ HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWOR
|
||||||
if (!region)
|
if (!region)
|
||||||
return DDERR_INVALIDCLIPLIST;
|
return DDERR_INVALIDCLIPLIST;
|
||||||
|
|
||||||
if (CombineRgn(This->region, region, This->region, RGN_OR) == ERROR)
|
if (CombineRgn(This->region, region, This->region, RGN_XOR) == ERROR)
|
||||||
{
|
{
|
||||||
DeleteObject(region);
|
DeleteObject(region);
|
||||||
DeleteObject(This->region);
|
DeleteObject(This->region);
|
||||||
|
@ -102,6 +105,9 @@ HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWOR
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (This->region)
|
||||||
|
DeleteObject(This->region);
|
||||||
|
|
||||||
This->region = NULL;
|
This->region = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue