]> git.proxmox.com Git - mirror_edk2.git/commitdiff
fix the issue when passing a L"" string to PrintXY.
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 4 Jun 2009 13:50:14 +0000 (13:50 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 4 Jun 2009 13:50:14 +0000 (13:50 +0000)
1. According to the value of RowInfoArraySize to get the actual number of printed line.
2. If RowInfoArraySize equates 0, then it means nothing is printed.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8464 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/UefiLib/UefiLibPrint.c

index 9dc3a5a200251e63ded9ea9c2ca37e3e675bff07..55487259fc36eaafb35eeb2f32137105a4d3b8be 100644 (file)
@@ -347,6 +347,9 @@ InternalPrintGraphic (
   EFI_UGA_DRAW_PROTOCOL               *UgaDraw;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *Sto;\r
   EFI_HANDLE                          ConsoleHandle;\r
+  UINTN                               Width;\r
+  UINTN                               Height;\r
+  UINTN                               Delta;\r
 \r
   HorizontalResolution  = 0;\r
   VerticalResolution    = 0;\r
@@ -485,6 +488,15 @@ InternalPrintGraphic (
       //\r
       ASSERT (RowInfoArraySize <= 1);\r
 \r
+      if (RowInfoArraySize != 0) {\r
+        Width  = RowInfoArray[0].LineWidth;\r
+        Height = RowInfoArray[0].LineHeight;\r
+        Delta  = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
+      } else {\r
+        Width  = 0;\r
+        Height = 0;\r
+        Delta  = 0;\r
+      }\r
       Status = UgaDraw->Blt (\r
                           UgaDraw,\r
                           (EFI_UGA_PIXEL *) Blt->Image.Bitmap,\r
@@ -493,9 +505,9 @@ InternalPrintGraphic (
                           PointY,\r
                           PointX,\r
                           PointY,\r
-                          RowInfoArray[0].LineWidth,\r
-                          RowInfoArray[0].LineHeight,\r
-                          Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+                          Width,\r
+                          Height,\r
+                          Delta\r
                           );\r
     } else {\r
       goto Error;\r
@@ -507,7 +519,11 @@ InternalPrintGraphic (
   //\r
   // Calculate the number of actual printed characters\r
   //\r
-  PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1;\r
+  if (RowInfoArraySize != 0) {\r
+    PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1;\r
+  } else {\r
+    PrintNum = 0;\r
+  }\r
 \r
   FreePool (RowInfoArray);\r
   FreePool (Blt);\r