1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

add missing lock

This commit is contained in:
FunkyFr3sh 2017-11-15 06:33:31 +01:00
parent 2dd84d86f6
commit 9821d80044
3 changed files with 16 additions and 12 deletions

BIN
ddraw.dll

Binary file not shown.

7
main.c
View File

@ -374,8 +374,6 @@ void ToggleFullscreen()
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
RECT rc = { 0, 0, ddraw->render.width, ddraw->render.height };
switch(uMsg) switch(uMsg)
{ {
case WM_MOVE: case WM_MOVE:
@ -521,11 +519,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_ERASEBKGND:
EnterCriticalSection(&ddraw->cs);
FillRect(ddraw->render.hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH));
LeaveCriticalSection(&ddraw->cs);
break;
} }
return ddraw->WndProc(hWnd, uMsg, wParam, lParam); return ddraw->WndProc(hWnd, uMsg, wParam, lParam);

View File

@ -120,11 +120,22 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
unsigned char* from=Source->surface + y0*Source->width + x0; unsigned char* from=Source->surface + y0*Source->width + x0;
int s = x1-x0; int s = x1-x0;
int y; if((This->caps & DDSCAPS_PRIMARYSURFACE) && !(This->flags & DDSD_BACKBUFFERCOUNT))
for(y=y0; y<y1; ++y, to+=This->width, from+=Source->width) {
{ EnterCriticalSection(&ddraw->cs);
memcpy(to, from, s);
} int y;
for(y=y0; y<y1; ++y, to+=This->width, from+=Source->width)
memcpy(to, from, s);
LeaveCriticalSection(&ddraw->cs);
}
else
{
int y;
for(y=y0; y<y1; ++y, to+=This->width, from+=Source->width)
memcpy(to, from, s);
}
} }
return DD_OK; return DD_OK;