#include <Library/BaseLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
-\r
+#include <Library/DebugLib.h>\r
\r
EFI_STATUS\r
GetGraphicsBitMapFromFV (\r
\r
Routine Description:\r
\r
- Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer\r
- is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt\r
+ Convert a *.BMP graphics image to a GOP/UGA blt buffer. If a NULL Blt buffer\r
+ is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt\r
buffer is passed in it will be used if it is big enough.\r
\r
Arguments:\r
\r
BmpImageSize - Number of bytes in BmpImage\r
\r
- UgaBlt - Buffer containing UGA version of BmpImage.\r
+ GopBlt - Buffer containing GOP version of BmpImage.\r
\r
- UgaBltSize - Size of UgaBlt in bytes.\r
+ GopBltSize - Size of GopBlt in bytes.\r
\r
- PixelHeight - Height of UgaBlt/BmpImage in pixels\r
+ PixelHeight - Height of GopBlt/BmpImage in pixels\r
\r
- PixelWidth - Width of UgaBlt/BmpImage in pixels\r
+ PixelWidth - Width of GopBlt/BmpImage in pixels\r
\r
\r
Returns:\r
\r
- EFI_SUCCESS - UgaBlt and UgaBltSize are returned.\r
+ EFI_SUCCESS - GopBlt and GopBltSize are returned.\r
EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image\r
- EFI_BUFFER_TOO_SMALL - The passed in UgaBlt buffer is not big enough.\r
- UgaBltSize will contain the required size.\r
+ EFI_BUFFER_TOO_SMALL - The passed in GopBlt buffer is not big enough.\r
+ GopBltSize will contain the required size.\r
EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
\r
--*/\r
\r
Routine Description:\r
\r
- Use Console Control to turn on UGA based Simple Text Out consoles. The UGA\r
- Simple Text Out screens will now be synced up with all non UGA output devices\r
+ Use Console Control to turn on GOP/UGA based Simple Text Out consoles. The GOP/UGA\r
+ Simple Text Out screens will now be synced up with all non GOP/UGA output devices\r
\r
Arguments:\r
\r
\r
Returns:\r
\r
- EFI_SUCCESS - UGA devices are back in text mode and synced up.\r
+ EFI_SUCCESS - GOP/UGA devices are back in text mode and synced up.\r
EFI_UNSUPPORTED - Logo not found\r
\r
--*/\r
\r
--*/\r
{\r
- VOID *Buffer;\r
- EFI_STATUS Status;\r
- UINT16 GlyphWidth;\r
- UINT32 GlyphStatus;\r
- UINT16 StringIndex;\r
- UINTN Index;\r
- CHAR16 *UnicodeWeight;\r
- EFI_NARROW_GLYPH *Glyph;\r
- EFI_HII_PROTOCOL *Hii;\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;\r
- UINT32 HorizontalResolution;\r
- UINT32 VerticalResolution;\r
- UINT32 ColorDepth;\r
- UINT32 RefreshRate;\r
- UINTN BufferGlyphWidth;\r
+ VOID *Buffer;\r
+ EFI_STATUS Status;\r
+ UINT16 GlyphWidth;\r
+ UINT32 GlyphStatus;\r
+ UINT16 StringIndex;\r
+ UINTN Index;\r
+ CHAR16 *UnicodeWeight;\r
+ EFI_NARROW_GLYPH *Glyph;\r
+ EFI_HII_PROTOCOL *Hii;\r
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;\r
+ UINT32 HorizontalResolution;\r
+ UINT32 VerticalResolution;\r
+ UINT32 ColorDepth;\r
+ UINT32 RefreshRate;\r
+ UINTN BufferLen;\r
+ UINTN LineBufferLen;\r
+ UINTN BufferGlyphWidth;\r
\r
GlyphStatus = 0;\r
\r
//\r
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);\r
}\r
+ ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));\r
\r
- LineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);\r
+ LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;\r
+ LineBuffer = AllocatePool (LineBufferLen);\r
if (LineBuffer == NULL) {\r
gBS->FreePool (Buffer);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
}\r
\r
- for (Index = 0; Index < StrLen (Buffer); Index++) {\r
+ BufferLen = StrLen (Buffer);\r
+\r
+ if (GLYPH_WIDTH * GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Error;\r
+ }\r
+\r
+ for (Index = 0; Index < BufferLen; Index++) {\r
StringIndex = (UINT16) Index;\r
Status = Hii->GetGlyph (Hii, UnicodeWeight, &StringIndex, (UINT8 **) &Glyph, &GlyphWidth, &GlyphStatus);\r
if (EFI_ERROR (Status)) {\r
(UINT8 *) Glyph,\r
mEfiColors[Sto->Mode->Attribute & 0x0f],\r
mEfiColors[Sto->Mode->Attribute >> 4],\r
- StrLen (Buffer),\r
+ BufferLen,\r
GlyphWidth,\r
GLYPH_HEIGHT,\r
&LineBuffer[Index * GLYPH_WIDTH]\r
(UINT8 *) Glyph,\r
*Foreground,\r
*Background,\r
- StrLen (Buffer),\r
+ BufferLen,\r
GlyphWidth,\r
GLYPH_HEIGHT,\r
&LineBuffer[Index * GLYPH_WIDTH]\r
//\r
// Blt a character to the screen\r
//\r
- BufferGlyphWidth = GLYPH_WIDTH * StrLen (Buffer);\r
+ BufferGlyphWidth = GLYPH_WIDTH * BufferLen;\r
if (GraphicsOutput != NULL) {\r
Status = GraphicsOutput->Blt (\r
GraphicsOutput,\r