From 86eaad5b79e158eaa6b09a615e32f00fe4fff268 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Tue, 7 Sep 2021 10:19:06 +0300 Subject: [PATCH] Fixed off-by-one error in background blit. --- SpaceCadetPinball/gdrv.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SpaceCadetPinball/gdrv.cpp b/SpaceCadetPinball/gdrv.cpp index 1a6d9b6..cf354a3 100644 --- a/SpaceCadetPinball/gdrv.cpp +++ b/SpaceCadetPinball/gdrv.cpp @@ -326,13 +326,13 @@ void gdrv::blat(gdrv_bitmap8* bmp, int xDest, int yDest) GetClientRect(hwnd, &client); if (fullscrn::OffsetX > 0) { - BitBlt(dc, 0, 0, fullscrn::OffsetX, client.bottom, dc, 0, 0, rop); - BitBlt(dc, client.right - fullscrn::OffsetX, 0, client.right, client.bottom, dc, 0, 0, rop); + BitBlt(dc, 0, 0, min(fullscrn::OffsetX + 2, client.right), client.bottom, dc, 0, 0, rop); + BitBlt(dc, max(client.right - fullscrn::OffsetX - 2, 0), 0, client.right, client.bottom, dc, 0, 0, rop); } else { - BitBlt(dc, 0, 0, client.right, fullscrn::OffsetY, dc, 0, 0, rop); - BitBlt(dc, 0, client.bottom - fullscrn::OffsetY, client.right, client.bottom, dc, 0, 0, rop); + BitBlt(dc, 0, 0, client.right, min(fullscrn::OffsetY + 2, client.bottom), dc, 0, 0, rop); + BitBlt(dc, 0, max(client.bottom - fullscrn::OffsetY - 2, 0), client.right, client.bottom, dc, 0, 0, rop); } }