https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e2daca3f605900da4af5b6...
commit e2daca3f605900da4af5b60ee31728d91f3277ce Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Fri Jan 7 00:53:54 2022 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Feb 6 17:52:46 2022 +0100
[FREELDR:UI] Improve drawing of progress bars, reducing flickering.
- Remove excessive UiDrawBackdrop() calls that caused too many unnecessary redraws.
- ProgressBar: Clear only the portions that need to be cleared up. This allows to not use DrawBackdrop anymore and the flickering. --- boot/freeldr/freeldr/disk/ramdisk.c | 1 - boot/freeldr/freeldr/ntldr/setupldr.c | 4 +--- boot/freeldr/freeldr/ntldr/winldr.c | 5 ----- boot/freeldr/freeldr/ui/minitui.c | 15 +++++++++++++-- boot/freeldr/freeldr/ui/tui.c | 13 ++++--------- 5 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/boot/freeldr/freeldr/disk/ramdisk.c b/boot/freeldr/freeldr/disk/ramdisk.c index 9f623baf506..58f8a37d528 100644 --- a/boot/freeldr/freeldr/disk/ramdisk.c +++ b/boot/freeldr/freeldr/disk/ramdisk.c @@ -117,7 +117,6 @@ RamDiskLoadVirtualFile( LARGE_INTEGER Position;
/* Display progress */ - UiDrawBackdrop(); UiDrawProgressBarCenter(1, 100, MsgBuffer);
/* Try opening the Ramdisk file */ diff --git a/boot/freeldr/freeldr/ntldr/setupldr.c b/boot/freeldr/freeldr/ntldr/setupldr.c index e80d15e03a6..89fde95d4b9 100644 --- a/boot/freeldr/freeldr/ntldr/setupldr.c +++ b/boot/freeldr/freeldr/ntldr/setupldr.c @@ -490,9 +490,8 @@ LoadReactOSSetup( return EINVAL; }
- UiDrawStatusText("Setup is loading..."); - UiDrawBackdrop(); + UiDrawStatusText("Setup is loading..."); UiDrawProgressBarCenter(1, 100, "Loading ReactOS Setup...");
/* Retrieve the system path */ @@ -738,7 +737,6 @@ LoadReactOSSetup( SetupBlock->Flags = SETUPLDR_TEXT_MODE;
/* Load the "setupreg.hiv" setup system hive */ - UiDrawBackdrop(); UiDrawProgressBarCenter(15, 100, "Loading setup system hive..."); Success = WinLdrInitSystemHive(LoaderBlock, BootPath, TRUE); TRACE("Setup SYSTEM hive %s\n", (Success ? "loaded" : "not loaded")); diff --git a/boot/freeldr/freeldr/ntldr/winldr.c b/boot/freeldr/freeldr/ntldr/winldr.c index e1b97336281..b485835fcb4 100644 --- a/boot/freeldr/freeldr/ntldr/winldr.c +++ b/boot/freeldr/freeldr/ntldr/winldr.c @@ -382,7 +382,6 @@ WinLdrLoadModule(PCSTR ModuleName, //CHAR ProgressString[256];
/* Inform user we are loading files */ - //UiDrawBackdrop(); //RtlStringCbPrintfA(ProgressString, sizeof(ProgressString), "Loading %s...", FileName); //UiDrawProgressBarCenter(1, 100, ProgressString);
@@ -467,7 +466,6 @@ LoadModule( CHAR ProgressString[256]; PVOID BaseAddress = NULL;
- UiDrawBackdrop(); RtlStringCbPrintfA(ProgressString, sizeof(ProgressString), "Loading %s...", File); UiDrawProgressBarCenter(Percentage, 100, ProgressString);
@@ -918,7 +916,6 @@ LoadAndBootWindows( AllocateAndInitLPB(OperatingSystemVersion, &LoaderBlock);
/* Load the system hive */ - UiDrawBackdrop(); UiDrawProgressBarCenter(15, 100, "Loading system hive..."); Success = WinLdrInitSystemHive(LoaderBlock, BootPath, FALSE); TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded")); @@ -977,7 +974,6 @@ LoadAndBootWindowsCommon( SystemRoot = strstr(BootPath, "\");
/* Detect hardware */ - UiDrawBackdrop(); UiDrawProgressBarCenter(20, 100, "Detecting hardware..."); LoaderBlock->ConfigurationRoot = MachHwDetect();
@@ -994,7 +990,6 @@ LoadAndBootWindowsCommon( }
/* Load boot drivers */ - UiDrawBackdrop(); UiDrawProgressBarCenter(100, 100, "Loading boot drivers..."); Success = WinLdrLoadBootDrivers(LoaderBlock, BootPath); TRACE("Boot drivers loading %s\n", Success ? "successful" : "failed"); diff --git a/boot/freeldr/freeldr/ui/minitui.c b/boot/freeldr/freeldr/ui/minitui.c index 95bb0b0eb1f..6c231af8b11 100644 --- a/boot/freeldr/freeldr/ui/minitui.c +++ b/boot/freeldr/freeldr/ui/minitui.c @@ -80,6 +80,15 @@ MiniTuiDrawProgressBar( /* First make sure the progress bar text fits */ UiTruncateStringEllipsis(ProgressText, ProgressBarWidth);
+ /* Clear the text area */ + TuiFillArea(Left, Top, Right, +#ifdef NTLDR_PROGRESSBAR + Bottom - 1, +#else // BTMGR_PROGRESSBAR + Bottom - 2, // One empty line between text and bar. +#endif + ' ', ATTR(UiTextColor, UiMenuBgColor)); + /* Draw the "Loading..." text */ TuiDrawCenteredText(Left, Top, Right, #ifdef NTLDR_PROGRESSBAR @@ -89,13 +98,15 @@ MiniTuiDrawProgressBar( #endif ProgressText, ATTR(UiTextColor, UiMenuBgColor));
- /* Draw the percent complete */ + /* Draw the percent complete -- Use the fill character */ for (i = 0; i < (Position * ProgressBarWidth) / Range; i++) { - /* Use the fill character */ TuiDrawText(Left + i, Bottom, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } + /* Fill the remaining with blanks */ + TuiFillArea(Left + i, Bottom, Right, Bottom, + ' ', ATTR(UiTextColor, UiMenuBgColor));
#ifndef _M_ARM TuiUpdateDateTime(); diff --git a/boot/freeldr/freeldr/ui/tui.c b/boot/freeldr/freeldr/ui/tui.c index 821d7b399ba..d14b1f656fc 100644 --- a/boot/freeldr/freeldr/ui/tui.c +++ b/boot/freeldr/freeldr/ui/tui.c @@ -744,20 +744,15 @@ TuiDrawProgressBar( TuiDrawCenteredText(Left, Top, Right, Bottom - 1, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
- /* Draw the percent complete */ + /* Draw the percent complete -- Use the fill character */ for (i = 0; i < (Position * ProgressBarWidth) / Range; i++) { - /* Use the fill character */ TuiDrawText(Left + i, Bottom, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } - - /* Draw the shadow */ - for (; i < ProgressBarWidth; i++) - { - TuiDrawText(Left + i, Bottom, - "\xB2", ATTR(UiTextColor, UiMenuBgColor)); - } + /* Fill the remaining with shadow blanks */ + TuiFillArea(Left + i, Bottom, Right, Bottom, + '\xB2', ATTR(UiTextColor, UiMenuBgColor));
#ifndef _M_ARM TuiUpdateDateTime();