X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FHiiDatabaseDxe%2FFont.c;h=5ecd6bd4a1e4f0d32e9c857a8451c7d7660b5824;hp=6cc350c42d9c904e133b9a23a5b3ad43d744f571;hb=d2970bbc1d88dbde480e7eef57f3ddcedd39ad08;hpb=6e1e5405544724406f07344a5911298c3df44129 diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 6cc350c42d..5ecd6bd4a1 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_FONT_PROTOCOL. -Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -704,10 +704,6 @@ FindGlyphBlock ( (UINT8 *) FontPackage->FontPkgHdr + 3 * sizeof (UINT32), sizeof (EFI_HII_GLYPH_INFO) ); - BaseLine = (UINT16) (LocalCell.Height + LocalCell.OffsetY); - if (MinOffsetY > LocalCell.OffsetY) { - MinOffsetY = LocalCell.OffsetY; - } } BlockPtr = FontPackage->GlyphBlock; @@ -933,16 +929,18 @@ SaveFontName ( ) { UINTN FontInfoLen; + UINTN NameSize; ASSERT (FontName != NULL && FontInfo != NULL); - FontInfoLen = sizeof (EFI_FONT_INFO) - sizeof (CHAR16) + StrSize (FontName); + NameSize = StrSize (FontName); + FontInfoLen = sizeof (EFI_FONT_INFO) - sizeof (CHAR16) + NameSize; *FontInfo = (EFI_FONT_INFO *) AllocateZeroPool (FontInfoLen); if (*FontInfo == NULL) { return EFI_OUT_OF_RESOURCES; } - StrCpy ((*FontInfo)->FontName, FontName); + StrCpyS ((*FontInfo)->FontName, NameSize / sizeof (CHAR16), FontName); return EFI_SUCCESS; } @@ -971,6 +969,7 @@ GetSystemFont ( { EFI_FONT_DISPLAY_INFO *Info; UINTN InfoSize; + UINTN NameSize; if (Private == NULL || Private->Signature != HII_DATABASE_PRIVATE_DATA_SIGNATURE) { return EFI_INVALID_PARAMETER; @@ -982,7 +981,8 @@ GetSystemFont ( // // The standard font always has the name "sysdefault". // - InfoSize = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + StrSize (L"sysdefault"); + NameSize = StrSize (L"sysdefault"); + InfoSize = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + NameSize; Info = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (InfoSize); if (Info == NULL) { return EFI_OUT_OF_RESOURCES; @@ -993,7 +993,7 @@ GetSystemFont ( Info->FontInfoMask = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_SYS_STYLE; Info->FontInfo.FontStyle = 0; Info->FontInfo.FontSize = EFI_GLYPH_HEIGHT; - StrCpy (Info->FontInfo.FontName, L"sysdefault"); + StrCpyS (Info->FontInfo.FontName, NameSize / sizeof (CHAR16), L"sysdefault"); *FontInfo = Info; if (FontInfoSize != NULL) { @@ -1444,6 +1444,7 @@ IsLineBreak ( // // Mandatory line break characters, which force a line-break // + case 0x000A: case 0x000C: case 0x000D: case 0x2028: @@ -1608,6 +1609,7 @@ HiiStringToImage ( UINTN StrLength; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *RowBufferPtr; HII_GLOBAL_FONT_INFO *GlobalFont; + UINT32 PreInitBkgnd; // // Check incoming parameters. @@ -2044,6 +2046,11 @@ HiiStringToImage ( goto Exit; } // + // Initialize the background color. + // + PreInitBkgnd = Background.Blue | Background.Green << 8 | Background.Red << 16; + SetMem32 (BltBuffer,RowInfo[RowIndex].LineWidth * RowInfo[RowIndex].LineHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),PreInitBkgnd); + // // Set BufferPtr to Origin by adding baseline to the starting position. // BufferPtr = BltBuffer + BaseLine * RowInfo[RowIndex].LineWidth; @@ -2151,9 +2158,8 @@ HiiStringToImage ( NextLine: // - // Recalculate the start point of X/Y axis to draw multi-lines with the order of top-to-down + // Recalculate the start point of Y axis to draw multi-lines with the order of top-to-down // - BltX = 0; BltY += RowInfo[RowIndex].LineHeight; RowIndex++; @@ -2309,6 +2315,7 @@ HiiStringIdToImage ( EFI_STRING String; UINTN StringSize; UINTN FontLen; + UINTN NameSize; EFI_FONT_INFO *StringFontInfo; EFI_FONT_DISPLAY_INFO *NewStringInfo; CHAR8 TempSupportedLanguages; @@ -2431,7 +2438,8 @@ HiiStringIdToImage ( // StringFontInfo equals NULL means system default font attaches with the string block. // if (StringFontInfo != NULL && IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfo, NULL, NULL)) { - FontLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + StrSize (StringFontInfo->FontName); + NameSize = StrSize (StringFontInfo->FontName); + FontLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + NameSize; NewStringInfo = AllocateZeroPool (FontLen); if (NewStringInfo == NULL) { Status = EFI_OUT_OF_RESOURCES; @@ -2440,7 +2448,7 @@ HiiStringIdToImage ( NewStringInfo->FontInfoMask = EFI_FONT_INFO_SYS_FORE_COLOR | EFI_FONT_INFO_SYS_BACK_COLOR; NewStringInfo->FontInfo.FontStyle = StringFontInfo->FontStyle; NewStringInfo->FontInfo.FontSize = StringFontInfo->FontSize; - StrCpy (NewStringInfo->FontInfo.FontName, StringFontInfo->FontName); + StrCpyS (NewStringInfo->FontInfo.FontName, NameSize / sizeof (CHAR16), StringFontInfo->FontName); Status = HiiStringToImage ( This,