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

add a check for DDSCAPS_OWNDC

This commit is contained in:
FunkyFr3sh 2024-10-18 18:02:30 +02:00
parent 9671d810af
commit a4f927b095

View File

@ -917,7 +917,8 @@ HRESULT dds_GetDC(IDirectDrawSurfaceImpl* This, HDC FAR* lpHDC)
if (lpHDC)
*lpHDC = dc;
InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));
if (!(This->caps & DDSCAPS_OWNDC))
InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));
return DD_OK;
}
@ -1025,7 +1026,8 @@ HRESULT dds_ReleaseDC(IDirectDrawSurfaceImpl* This, HDC hDC)
}
}
RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));
if (!(This->caps & DDSCAPS_OWNDC))
RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));
return DD_OK;
}