[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.
This commit is contained in:
Hermès Bélusca-Maïto 2022-01-07 00:53:54 +01:00
parent 9101247366
commit e2daca3f60
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 18 additions and 20 deletions

View file

@ -117,7 +117,6 @@ RamDiskLoadVirtualFile(
LARGE_INTEGER Position;
/* Display progress */
UiDrawBackdrop();
UiDrawProgressBarCenter(1, 100, MsgBuffer);
/* Try opening the Ramdisk file */

View file

@ -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"));

View file

@ -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");

View file

@ -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();

View file

@ -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();