Skip to content

Commit

Permalink
simplify GetAttachedSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed May 24, 2024
1 parent c1a14a3 commit 0858392
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions src/ddsurface.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,29 +810,13 @@ HRESULT dds_Flip(IDirectDrawSurfaceImpl* This, IDirectDrawSurfaceImpl* lpDDSurfa

HRESULT dds_GetAttachedSurface(IDirectDrawSurfaceImpl* This, LPDDSCAPS lpDdsCaps, IDirectDrawSurfaceImpl** lpDDsurface)
{
if (lpDdsCaps->dwCaps & DDSCAPS_BACKBUFFER)
{
if (This->backbuffer)
{
IDirectDrawSurface_AddRef(This->backbuffer);
*lpDDsurface = This->backbuffer;
}
else
{
IDirectDrawSurface_AddRef(This);
*lpDDsurface = This;
}

return DD_OK;
}
if (!lpDdsCaps || !lpDDsurface)
return DDERR_INVALIDPARAMS;

if (lpDdsCaps->dwCaps & DDSCAPS_FLIP)
if (This->backbuffer && (This->backbuffer->caps & lpDdsCaps->dwCaps) == lpDdsCaps->dwCaps)
{
if (This->backbuffer)
{
IDirectDrawSurface_AddRef(This->backbuffer);
*lpDDsurface = This->backbuffer;
}
IDirectDrawSurface_AddRef(This->backbuffer);
*lpDDsurface = This->backbuffer;

return DD_OK;
}
Expand Down

0 comments on commit 0858392

Please sign in to comment.