]> git.proxmox.com Git - mirror_edk2.git/commitdiff
update the file description of PrintXY and AsciiPrintXY. and also refine the implemen...
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 21 May 2009 10:02:33 +0000 (10:02 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 21 May 2009 10:02:33 +0000 (10:02 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8372 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/UefiLib.h
MdePkg/Library/UefiLib/UefiLibPrint.c

index fd93dcc719a5bf82b16830b9ea188e8e3dc1d966..e2d53be6e89d97922ace05f43b45aa39b52e47e4 100644 (file)
@@ -1077,10 +1077,12 @@ AsciiErrorPrint (
   Unicode characters displayed, not including partial characters that may be clipped \r
   by the right edge of the display.  If the length of the formatted Unicode string is\r
   greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
-  PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
-  is used to convert the string to a bitmap using the glyphs registered with the \r
-  HII database.  No wrapping is performed, so any portions of the string the fall\r
-  outside the active display region will not be displayed.\r
+  PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL\r
+  StringToImage() service is used to convert the string to a bitmap using the glyphs \r
+  registered with the HII database. No wrapping is performed, so any portions of the \r
+  string the fall outside the active display region will not be displayed. Please see \r
+  Section 27.2.6 of the UEFI Specification for a description of the supported string\r
+  format including the set of control codes supported by the StringToImage() service.\r
 \r
   If a graphics console device is not associated with the ConsoleOutputHandle \r
   defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
@@ -1127,10 +1129,12 @@ PrintXY (
   ASCII characters displayed, not including partial characters that may be clipped \r
   by the right edge of the display.  If the length of the formatted ASCII string is\r
   greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
-  PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
-  is used to convert the string to a bitmap using the glyphs registered with the \r
-  HII database.  No wrapping is performed, so any portions of the string the fall\r
-  outside the active display region will not be displayed.\r
+  PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL\r
+  StringToImage() service is used to convert the string to a bitmap using the glyphs \r
+  registered with the HII database. No wrapping is performed, so any portions of the \r
+  string the fall outside the active display region will not be displayed. Please see \r
+  Section 27.2.6 of the UEFI Specification for a description of the supported string\r
+  format including the set of control codes supported by the StringToImage() service.\r
 \r
   If a graphics console device is not associated with the ConsoleOutputHandle \r
   defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
index fc68e6659ad327059c755f921e917f344c93f9a5..9c80d01a55de78f76422f7dd04e4060eb8206423 100644 (file)
@@ -2,7 +2,7 @@
   Mde UEFI library API implementation.\r
   Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE\r
 \r
-  Copyright (c) 2007 - 2008, Intel Corporation<BR>\r
+  Copyright (c) 2007 - 2009, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -334,13 +334,10 @@ InternalPrintGraphic (
   )\r
 {\r
   EFI_STATUS                          Status;\r
-  UINTN                               Index;\r
-  CHAR16                              *UnicodeWeight;\r
   UINT32                              HorizontalResolution;\r
   UINT32                              VerticalResolution;\r
   UINT32                              ColorDepth;\r
   UINT32                              RefreshRate;\r
-  UINTN                               LineBufferLen;\r
   EFI_HII_FONT_PROTOCOL               *HiiFont;\r
   EFI_IMAGE_OUTPUT                    *Blt;\r
   EFI_FONT_DISPLAY_INFO               FontInfo;\r
@@ -354,6 +351,7 @@ InternalPrintGraphic (
   HorizontalResolution  = 0;\r
   VerticalResolution    = 0;\r
   Blt                   = NULL;\r
+  RowInfoArray          = NULL;\r
 \r
   ConsoleHandle = gST->ConsoleOutHandle;\r
 \r
@@ -377,7 +375,7 @@ InternalPrintGraphic (
                     );\r
   }\r
   if (EFI_ERROR (Status)) {\r
-    return 0;\r
+    goto Error;\r
   }\r
 \r
   Status = gBS->HandleProtocol (\r
@@ -387,7 +385,7 @@ InternalPrintGraphic (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    return 0;\r
+    goto Error;\r
   }\r
 \r
   if (GraphicsOutput != NULL) {\r
@@ -396,7 +394,6 @@ InternalPrintGraphic (
   } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);\r
   } else {\r
-    Status = EFI_UNSUPPORTED;\r
     goto Error;\r
   }\r
 \r
@@ -407,21 +404,6 @@ InternalPrintGraphic (
     goto Error;\r
   }\r
 \r
-  UnicodeWeight = Buffer;\r
-\r
-  for (Index = 0; UnicodeWeight[Index] != 0; Index++) {\r
-    if (UnicodeWeight[Index] == CHAR_BACKSPACE ||\r
-        UnicodeWeight[Index] == CHAR_LINEFEED  ||\r
-        UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {\r
-      UnicodeWeight[Index] = 0;\r
-    }\r
-  }\r
-\r
-  LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;\r
-  if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * PrintNum > LineBufferLen) {\r
-    PrintNum = HorizontalResolution / EFI_GLYPH_WIDTH;\r
-  }\r
-\r
   Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));\r
   ASSERT (Blt != NULL);\r
 \r
@@ -454,16 +436,21 @@ InternalPrintGraphic (
 \r
     Status = HiiFont->StringToImage (\r
                          HiiFont,\r
-                         EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,\r
+                         EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |\r
+                         EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |\r
+                         EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,\r
                          Buffer,\r
                          &FontInfo,\r
                          &Blt,\r
                          PointX,\r
                          PointY,\r
-                         NULL,\r
-                         NULL,\r
+                         &RowInfoArray,\r
+                         &RowInfoArraySize,\r
                          NULL\r
                          );\r
+    if (EFI_ERROR (Status)) {\r
+      goto Error;\r
+    }\r
 \r
   } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     ASSERT (UgaDraw!= NULL);\r
@@ -471,7 +458,6 @@ InternalPrintGraphic (
     Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
     ASSERT (Blt->Image.Bitmap != NULL);\r
 \r
-    RowInfoArray = NULL;\r
     //\r
     //  StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,\r
     //  we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.\r
@@ -509,23 +495,27 @@ InternalPrintGraphic (
                           RowInfoArray[0].LineHeight,\r
                           Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                           );\r
+    } else {\r
+      goto Error;\r
     }\r
-\r
-    FreePool (RowInfoArray);\r
     FreePool (Blt->Image.Bitmap);\r
-\r
   } else {\r
-    Status = EFI_UNSUPPORTED;\r
+    goto Error;\r
   }\r
+  //\r
+  // Calculate the number of actual printed characters\r
+  //\r
+  PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1;\r
 \r
+  FreePool (RowInfoArray);\r
   FreePool (Blt);\r
+  return PrintNum;\r
 \r
 Error:\r
-  if (EFI_ERROR (Status)) {\r
-    return 0;\r
-  } else {\r
-    return PrintNum;\r
+  if (Blt != NULL) {\r
+    FreePool (Blt);\r
   }\r
+  return 0;\r
 }\r
 \r
 /**\r
@@ -537,10 +527,12 @@ Error:
   Unicode characters displayed, not including partial characters that may be clipped \r
   by the right edge of the display.  If the length of the formatted Unicode string is\r
   greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
-  PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
-  is used to convert the string to a bitmap using the glyphs registered with the \r
-  HII database.  No wrapping is performed, so any portions of the string the fall\r
-  outside the active display region will not be displayed.\r
+  PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL\r
+  StringToImage() service is used to convert the string to a bitmap using the glyphs \r
+  registered with the HII database. No wrapping is performed, so any portions of the \r
+  string the fall outside the active display region will not be displayed. Please see \r
+  Section 27.2.6 of the UEFI Specification for a description of the supported string\r
+  format including the set of control codes supported by the StringToImage() service.\r
 \r
   If a graphics console device is not associated with the ConsoleOutputHandle \r
   defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
@@ -612,10 +604,12 @@ PrintXY (
   ASCII characters displayed, not including partial characters that may be clipped \r
   by the right edge of the display.  If the length of the formatted ASCII string is\r
   greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
-  PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
-  is used to convert the string to a bitmap using the glyphs registered with the \r
-  HII database.  No wrapping is performed, so any portions of the string the fall\r
-  outside the active display region will not be displayed.\r
+  PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL\r
+  StringToImage() service is used to convert the string to a bitmap using the glyphs \r
+  registered with the HII database. No wrapping is performed, so any portions of the \r
+  string the fall outside the active display region will not be displayed. Please see \r
+  Section 27.2.6 of the UEFI Specification for a description of the supported string\r
+  format including the set of control codes supported by the StringToImage() service.\r
 \r
   If a graphics console device is not associated with the ConsoleOutputHandle \r
   defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r