From 3178252fa792da5a35ad9bdf5d30673a5d593745 Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Fri, 15 Jan 2021 16:07:30 +0100 Subject: [PATCH] [0.4.13][USETUP] Do a trick to avoid visual "blinking" during screen clearing (#3255) CORE-17312 Hide everything under the same foreground & background colors, so that the actual color and text blanking reset does not create a visual "blinking". Then, blank the text and finally reset the actual foreground & background colors. We do this because we cannot do the screen scrolling trick that would allow to change both the text and the colors at the same time (the function is currently not available in our console "emulation" layer). The issue was unhidden when we introduced the red progress bar in 0.4.11-dev-111-g e5c0bfacf1374abf34abbaf75047149a6252ca5e Fix picked from 0.4.15-dev-1078-g 434fa562cec395fdda203f78f3682958663c1e3b --- base/setup/usetup/consup.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/base/setup/usetup/consup.c b/base/setup/usetup/consup.c index a919e076248..4e9fe951950 100644 --- a/base/setup/usetup/consup.c +++ b/base/setup/usetup/consup.c @@ -240,19 +240,32 @@ CONSOLE_ClearScreen(VOID) coPos.X = 0; coPos.Y = 0; - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_WHITE | BACKGROUND_BLUE, - xScreen * yScreen, - coPos, - &Written); + /* + * Hide everything under the same foreground & background colors, so that + * the actual color and text blanking reset does not create a visual "blinking". + * We do this because we cannot do the screen scrolling trick that would + * allow to change both the text and the colors at the same time (the + * function is currently not available in our console "emulation" layer). + */ + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_BLUE | BACKGROUND_BLUE, + xScreen * yScreen, + coPos, + &Written); - FillConsoleOutputCharacterA( - StdOutput, - ' ', - xScreen * yScreen, - coPos, - &Written); + /* Blank the text */ + FillConsoleOutputCharacterA(StdOutput, + ' ', + xScreen * yScreen, + coPos, + &Written); + + /* Reset the actual foreground & background colors */ + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, + xScreen * yScreen, + coPos, + &Written); } VOID