Re: [edk2] [Patch V2 5/5] Nt32Pkg: Use LogoLib for LOGO and progress bar drawing.

2015-11-11 Thread Dong, Eric
Reviewed-by: Eric Dong 

-Original Message-
From: Ni, Ruiyu 
Sent: Monday, November 09, 2015 1:24 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Dong, Eric
Subject: [Patch V2 5/5] Nt32Pkg: Use LogoLib for LOGO and progress bar drawing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Eric Dong 
---
 .../Library/PlatformBootManagerLib/MemoryTest.c| 833 +
 .../PlatformBootManagerLib/PlatformBootManager.c   |   6 +-
 .../PlatformBootManagerLib/PlatformBootManager.h   |   6 +-
 .../PlatformBootManagerLib.inf |   2 +-
 Nt32Pkg/Nt32Pkg.dsc|   7 +-
 5 files changed, 14 insertions(+), 840 deletions(-)

diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c 
b/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
index 9f57466..93ecc7d 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
@@ -23,179 +23,6 @@ EFI_GUID   mPlatformBootManagerStringPackGuid = {
 //
 // BDS Platform Functions
 //
-/**
-
-  Show progress bar with title above it. It only works in Graphics mode.
-
-
-  @param TitleForeground Foreground color for Title.
-  @param TitleBackground Background color for Title.
-  @param Title   Title above progress bar.
-  @param ProgressColor   Progress bar color.
-  @param ProgressProgress (0-100)
-  @param PreviousValue   The previous value of the progress.
-
-  @retval  EFI_STATUS   Success update the progress bar
-
-**/
-EFI_STATUS
-PlatformBootManagerShowProgress (
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
-  IN CHAR16*Title,
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
-  IN UINTN Progress,
-  IN UINTN PreviousValue
-  )
-{
-  EFI_STATUS Status;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput;
-  EFI_UGA_DRAW_PROTOCOL  *UgaDraw;
-  UINT32 SizeOfX;
-  UINT32 SizeOfY;
-  UINT32 ColorDepth;
-  UINT32 RefreshRate;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Color;
-  UINTN  BlockHeight;
-  UINTN  BlockWidth;
-  UINTN  BlockNum;
-  UINTN  PosX;
-  UINTN  PosY;
-  UINTN  Index;
-
-  if (Progress > 100) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  UgaDraw = NULL;
-  Status = gBS->HandleProtocol (
-  gST->ConsoleOutHandle,
-  &gEfiGraphicsOutputProtocolGuid,
-  (VOID **) &GraphicsOutput
-  );
-  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
-GraphicsOutput = NULL;
-
-Status = gBS->HandleProtocol (
-gST->ConsoleOutHandle,
-&gEfiUgaDrawProtocolGuid,
-(VOID **) &UgaDraw
-);
-  }
-  if (EFI_ERROR (Status)) {
-return EFI_UNSUPPORTED;
-  }
-
-  SizeOfX = 0;
-  SizeOfY = 0;
-  if (GraphicsOutput != NULL) {
-SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
-SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
-  } else if (UgaDraw != NULL) {
-Status = UgaDraw->GetMode (
-UgaDraw,
-&SizeOfX,
-&SizeOfY,
-&ColorDepth,
-&RefreshRate
-);
-if (EFI_ERROR (Status)) {
-  return EFI_UNSUPPORTED;
-}
-  } else {
-return EFI_UNSUPPORTED;
-  }
-
-  BlockWidth  = SizeOfX / 100;
-  BlockHeight = SizeOfY / 50;
-
-  BlockNum= Progress;
-
-  PosX= 0;
-  PosY= SizeOfY * 48 / 50;
-
-  if (BlockNum == 0) {
-//
-// Clear progress area
-//
-SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
-if (GraphicsOutput != NULL) {
-  Status = GraphicsOutput->Blt (
-  GraphicsOutput,
-  &Color,
-  EfiBltVideoFill,
-  0,
-  0,
-  0,
-  PosY - EFI_GLYPH_HEIGHT - 1,
-  SizeOfX,
-  SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
-  SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-  );
-} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
-  Status = UgaDraw->Blt (
-  UgaDraw,
-  (EFI_UGA_PIXEL *) &Color,
-  EfiUgaVideoFill,
-  0,
-  0,
-  0,
-  PosY - EFI_GLYPH_HEIGHT - 1,
-  SizeOfX,

[edk2] [Patch V2 5/5] Nt32Pkg: Use LogoLib for LOGO and progress bar drawing.

2015-11-08 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Eric Dong 
---
 .../Library/PlatformBootManagerLib/MemoryTest.c| 833 +
 .../PlatformBootManagerLib/PlatformBootManager.c   |   6 +-
 .../PlatformBootManagerLib/PlatformBootManager.h   |   6 +-
 .../PlatformBootManagerLib.inf |   2 +-
 Nt32Pkg/Nt32Pkg.dsc|   7 +-
 5 files changed, 14 insertions(+), 840 deletions(-)

diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c 
b/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
index 9f57466..93ecc7d 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
@@ -23,179 +23,6 @@ EFI_GUID   mPlatformBootManagerStringPackGuid = {
 //
 // BDS Platform Functions
 //
-/**
-
-  Show progress bar with title above it. It only works in Graphics mode.
-
-
-  @param TitleForeground Foreground color for Title.
-  @param TitleBackground Background color for Title.
-  @param Title   Title above progress bar.
-  @param ProgressColor   Progress bar color.
-  @param ProgressProgress (0-100)
-  @param PreviousValue   The previous value of the progress.
-
-  @retval  EFI_STATUS   Success update the progress bar
-
-**/
-EFI_STATUS
-PlatformBootManagerShowProgress (
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
-  IN CHAR16*Title,
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
-  IN UINTN Progress,
-  IN UINTN PreviousValue
-  )
-{
-  EFI_STATUS Status;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput;
-  EFI_UGA_DRAW_PROTOCOL  *UgaDraw;
-  UINT32 SizeOfX;
-  UINT32 SizeOfY;
-  UINT32 ColorDepth;
-  UINT32 RefreshRate;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Color;
-  UINTN  BlockHeight;
-  UINTN  BlockWidth;
-  UINTN  BlockNum;
-  UINTN  PosX;
-  UINTN  PosY;
-  UINTN  Index;
-
-  if (Progress > 100) {
-return EFI_INVALID_PARAMETER;
-  }
-
-  UgaDraw = NULL;
-  Status = gBS->HandleProtocol (
-  gST->ConsoleOutHandle,
-  &gEfiGraphicsOutputProtocolGuid,
-  (VOID **) &GraphicsOutput
-  );
-  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
-GraphicsOutput = NULL;
-
-Status = gBS->HandleProtocol (
-gST->ConsoleOutHandle,
-&gEfiUgaDrawProtocolGuid,
-(VOID **) &UgaDraw
-);
-  }
-  if (EFI_ERROR (Status)) {
-return EFI_UNSUPPORTED;
-  }
-
-  SizeOfX = 0;
-  SizeOfY = 0;
-  if (GraphicsOutput != NULL) {
-SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
-SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
-  } else if (UgaDraw != NULL) {
-Status = UgaDraw->GetMode (
-UgaDraw,
-&SizeOfX,
-&SizeOfY,
-&ColorDepth,
-&RefreshRate
-);
-if (EFI_ERROR (Status)) {
-  return EFI_UNSUPPORTED;
-}
-  } else {
-return EFI_UNSUPPORTED;
-  }
-
-  BlockWidth  = SizeOfX / 100;
-  BlockHeight = SizeOfY / 50;
-
-  BlockNum= Progress;
-
-  PosX= 0;
-  PosY= SizeOfY * 48 / 50;
-
-  if (BlockNum == 0) {
-//
-// Clear progress area
-//
-SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
-if (GraphicsOutput != NULL) {
-  Status = GraphicsOutput->Blt (
-  GraphicsOutput,
-  &Color,
-  EfiBltVideoFill,
-  0,
-  0,
-  0,
-  PosY - EFI_GLYPH_HEIGHT - 1,
-  SizeOfX,
-  SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
-  SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-  );
-} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
-  Status = UgaDraw->Blt (
-  UgaDraw,
-  (EFI_UGA_PIXEL *) &Color,
-  EfiUgaVideoFill,
-  0,
-  0,
-  0,
-  PosY - EFI_GLYPH_HEIGHT - 1,
-  SizeOfX,
-  SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
-  SizeOfX * sizeof (EFI_UGA_PIXEL)
-  );
-} else {
-  return EFI_UNSUPPORTED;
-}
-  }
-  //
-  // Show progress by