From 6ddb8d0a22cbe7e084029f53d84dd1718e3d55c8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 30 May 2016 01:16:11 +0200 Subject: [PATCH] removed potential multiple screen redraw in the same video frame --- src/tools.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/tools.c b/src/tools.c index 76fa6c48..6dc9129a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -570,14 +570,35 @@ void BackToFront() } else if (redraw_mask & REDRAW_DOORS) { - if (redraw_mask & REDRAW_DOOR_1) - BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY); + // merge door areas to prevent calling screen redraw more than once + int x1 = WIN_XSIZE; + int y1 = WIN_YSIZE; + int x2 = 0; + int y2 = 0; - if (redraw_mask & REDRAW_DOOR_2) - BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY); + if (redraw_mask & REDRAW_DOOR_1) + { + x1 = MIN(x1, DX); + y1 = MIN(y1, DY); + x2 = MAX(x2, DX + DXSIZE); + y2 = MAX(y2, DY + DYSIZE); + } + else if (redraw_mask & REDRAW_DOOR_2) + { + x1 = MIN(x1, VX); + y1 = MIN(y1, VY); + x2 = MAX(x2, VX + VXSIZE); + y2 = MAX(y2, VY + VYSIZE); + } + else if (redraw_mask & REDRAW_DOOR_3) + { + x1 = MIN(x1, EX); + y1 = MIN(y1, EY); + x2 = MAX(x2, EX + EXSIZE); + y2 = MAX(y2, EY + EYSIZE); + } - if (redraw_mask & REDRAW_DOOR_3) - BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY); + BlitBitmap(backbuffer, window, x1, y1, x2 - x1, y2 - y1, x1, y1); } redraw_mask = REDRAW_NONE; -- 2.34.1