Move video blit to seperate thread.

This commit is contained in:
SarahW 2016-07-18 21:15:32 +01:00
commit 9f4b159121
18 changed files with 268 additions and 99 deletions

View file

@ -13,6 +13,8 @@ extern "C" void device_force_redraw();
extern "C" void ddraw_fs_init(HWND h);
extern "C" void ddraw_fs_close();
extern "C" void video_blit_complete();
static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h);
@ -105,8 +107,8 @@ void ddraw_fs_init(HWND h)
pclog("DDRAW_INIT complete\n");
ddraw_hwnd = h;
video_blit_memtoscreen = ddraw_fs_blit_memtoscreen;
video_blit_memtoscreen_8 = ddraw_fs_blit_memtoscreen_8;
video_blit_memtoscreen_func = ddraw_fs_blit_memtoscreen;
video_blit_memtoscreen_8_func = ddraw_fs_blit_memtoscreen_8;
}
void ddraw_fs_close()
@ -207,9 +209,14 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = y1; yy < y2; yy++)
memcpy(ddsd.lpSurface + (yy * ddsd.lPitch), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
video_blit_complete();
lpdds_back->Unlock(NULL);
window_rect.left = 0;
@ -274,7 +281,11 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
if (!ddsd.lpSurface)
{
video_blit_complete();
return;
}
for (yy = 0; yy < h; yy++)
{
if ((y + yy) >= 0 && (y + yy) < buffer->h)
@ -284,6 +295,7 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
}
}
video_blit_complete();
lpdds_back->Unlock(NULL);
window_rect.left = 0;