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

#83 fix surface lock with rect

This commit is contained in:
FunkyFr3sh 2021-04-24 08:14:48 +02:00
parent 7e56551895
commit b7f485d935

View File

@ -690,7 +690,15 @@ HRESULT dds_Lock(IDirectDrawSurfaceImpl *This, LPRECT lpDestRect, LPDDSURFACEDES
{
dbg_dump_dds_lock_flags(dwFlags);
return dds_GetSurfaceDesc(This, lpDDSurfaceDesc);
HRESULT ret = dds_GetSurfaceDesc(This, lpDDSurfaceDesc);
if (lpDestRect && lpDDSurfaceDesc && lpDestRect->left >= 0 && lpDestRect->top >= 0)
{
lpDDSurfaceDesc->lpSurface =
(char*)This->surface + (lpDestRect->left * This->lx_pitch) + (lpDestRect->top * This->l_pitch);
}
return ret;
}
HRESULT dds_SetColorKey(IDirectDrawSurfaceImpl *This, DWORD flags, LPDDCOLORKEY colorKey)