Skip to content

Commit

Permalink
make sure we don't get a blackscreen if device doesn't support Stretc…
Browse files Browse the repository at this point in the history
…hDIBits
  • Loading branch information
FunkyFr3sh committed Sep 29, 2024
1 parent da99931 commit 5336f7d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/render_gdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ DWORD WINAPI gdi_render_main(void)
FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
}

int lines_copied = 0;

if (g_ddraw.bnet_active)
{
RECT rc = { 0, 0, g_ddraw.render.width, g_ddraw.render.height };
FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
lines_copied = 1;
}
else if (upscale_hack)
{
real_StretchDIBits(
lines_copied = real_StretchDIBits(
g_ddraw.render.hdc,
g_ddraw.render.viewport.x,
g_ddraw.render.viewport.y,
Expand All @@ -124,7 +127,7 @@ DWORD WINAPI gdi_render_main(void)
else if (!g_ddraw.child_window_exists &&
(g_ddraw.render.width != g_ddraw.width || g_ddraw.render.height != g_ddraw.height))
{
real_StretchDIBits(
lines_copied = real_StretchDIBits(
g_ddraw.render.hdc,
g_ddraw.render.viewport.x,
g_ddraw.render.viewport.y,
Expand All @@ -139,7 +142,8 @@ DWORD WINAPI gdi_render_main(void)
DIB_RGB_COLORS,
SRCCOPY);
}
else

if (lines_copied == 0 || lines_copied == GDI_ERROR)
{
real_SetDIBitsToDevice(
g_ddraw.render.hdc,
Expand Down

0 comments on commit 5336f7d

Please sign in to comment.