X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FHiiDatabaseDxe%2FImage.c;h=8c74e8e424d2cf6572d0ffbd2c408157dfeec67c;hp=e570913c6ffdd2fba54fa10e7cb35c552097203f;hb=f324bf4dbeda4d64b769bd005331e8f9404b692d;hpb=e94358a3fe824986cfaa777690170f26aa5a8200 diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c index e570913c6f..8c74e8e424 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c @@ -288,7 +288,7 @@ Output1bitPixel ( ZeroMem (PaletteValue, sizeof (PaletteValue)); CopyRgbToGopPixel (&PaletteValue[0], &Palette->PaletteValue[0], 1); CopyRgbToGopPixel (&PaletteValue[1], &Palette->PaletteValue[1], 1); - SafeFreePool (Palette); + FreePool (Palette); // // Convert the pixel from one bit to corresponding color. @@ -373,7 +373,7 @@ Output4bitPixel ( ZeroMem (PaletteValue, sizeof (PaletteValue)); CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum); - SafeFreePool (Palette); + FreePool (Palette); // // Convert the pixel from 4 bit to corresponding color. @@ -446,7 +446,7 @@ Output8bitPixel ( PaletteNum = (UINT16)(Palette->PaletteSize / sizeof (EFI_HII_RGB_PIXEL)); ZeroMem (PaletteValue, sizeof (PaletteValue)); CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum); - SafeFreePool (Palette); + FreePool (Palette); // // Convert the pixel from 8 bits to corresponding color. @@ -679,7 +679,7 @@ HiiNewImage ( ImagePackage->ImageBlock, ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK) ); - SafeFreePool (ImagePackage->ImageBlock); + FreePool (ImagePackage->ImageBlock); ImagePackage->ImageBlock = ImageBlock; ImageBlock += ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK); // @@ -687,8 +687,7 @@ HiiNewImage ( // NewBlock = AllocateZeroPool (NewBlockSize); if (NewBlock == NULL) { - SafeFreePool (ImagePackage->ImageBlock); - ImagePackage->ImageBlock = NULL; + FreePool (ImagePackage->ImageBlock); return EFI_OUT_OF_RESOURCES; } NewBlockPtr = NewBlock; @@ -735,7 +734,7 @@ HiiNewImage ( ImagePackage->ImageBlockSize = (UINT32) BlockSize; ImagePackage->ImageBlock = (UINT8 *) AllocateZeroPool (BlockSize); if (ImagePackage->ImageBlock == NULL) { - SafeFreePool (ImagePackage); + FreePool (ImagePackage); return EFI_OUT_OF_RESOURCES; } ImageBlock = ImagePackage->ImageBlock; @@ -745,8 +744,8 @@ HiiNewImage ( // NewBlock = AllocateZeroPool (NewBlockSize); if (NewBlock == NULL) { - SafeFreePool (ImagePackage->ImageBlock); - SafeFreePool (ImagePackage); + FreePool (ImagePackage->ImageBlock); + FreePool (ImagePackage); return EFI_OUT_OF_RESOURCES; } NewBlockPtr = NewBlock; @@ -774,7 +773,7 @@ HiiNewImage ( CopyGopToRgbPixel ((EFI_HII_RGB_PIXEL *) NewBlock, ImageIn->Bitmap, ImageIn->Width * ImageIn->Height); CopyMem (ImageBlock, NewBlockPtr, NewBlockSize); - SafeFreePool (NewBlockPtr); + FreePool (NewBlockPtr); // // Append the block end @@ -1156,7 +1155,7 @@ HiiSetImage ( BlockSize = ImagePackage->ImageBlockSize + NewBlockSize - OldBlockSize; Block = (UINT8 *) AllocateZeroPool (BlockSize); if (Block == NULL) { - SafeFreePool (NewBlock); + FreePool (NewBlock); return EFI_OUT_OF_RESOURCES; } @@ -1169,8 +1168,8 @@ HiiSetImage ( BlockPtr += NewBlockSize; CopyMem (BlockPtr, ImageBlock + OldBlockSize, Part2Size); - SafeFreePool (ImagePackage->ImageBlock); - SafeFreePool (NewBlock); + FreePool (ImagePackage->ImageBlock); + FreePool (NewBlock); ImagePackage->ImageBlock = Block; ImagePackage->ImageBlockSize = BlockSize; ImagePackage->ImagePkgHdr.Header.Length += NewBlockSize - OldBlockSize; @@ -1234,7 +1233,6 @@ HiiDrawImage ( UINTN OffsetY2; EFI_FONT_DISPLAY_INFO *FontInfo; UINTN Index; - EFI_CONSOLE_CONTROL_PROTOCOL *Console; if (This == NULL || Image == NULL || Blt == NULL) { return EFI_INVALID_PARAMETER; @@ -1324,17 +1322,10 @@ HiiDrawImage ( // Draw the image to existing bitmap or screen depending on flag. // if ((Flags & EFI_HII_DIRECT_TO_SCREEN) == EFI_HII_DIRECT_TO_SCREEN) { - Status = gBS->LocateProtocol ( - &gEfiConsoleControlProtocolGuid, - NULL, - (VOID **) &Console - ); - - if (EFI_ERROR (Status)) { - return Status; - } + // + // Caller should make sure the current UGA console is grarphic mode. + // - Console->SetMode (Console, EfiConsoleControlScreenGraphics); // // Write the image directly to the output device specified by Screen. // @@ -1366,7 +1357,7 @@ HiiDrawImage ( } - SafeFreePool (BltBuffer); + FreePool (BltBuffer); return Status; } else { @@ -1384,7 +1375,7 @@ HiiDrawImage ( ImageOut = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT)); if (ImageOut == NULL) { - SafeFreePool (BltBuffer); + FreePool (BltBuffer); return EFI_OUT_OF_RESOURCES; } ImageOut->Width = (UINT16) Width; @@ -1397,14 +1388,14 @@ HiiDrawImage ( // Status = GetSystemFont (Private, &FontInfo, NULL); if (EFI_ERROR (Status)) { - SafeFreePool (BltBuffer); - SafeFreePool (ImageOut); + FreePool (BltBuffer); + FreePool (ImageOut); return Status; } for (Index = 0; Index < Width * Height; Index++) { BltBuffer[Index] = FontInfo->BackgroundColor; } - SafeFreePool (FontInfo); + FreePool (FontInfo); // // Draw the incoming image to the new created image. @@ -1494,7 +1485,9 @@ HiiDrawImageId ( // Draw this image. // Status = HiiDrawImage (This, Flags, &Image, Blt, BltX, BltY); - SafeFreePool (Image.Bitmap); + if (Image.Bitmap != NULL) { + FreePool (Image.Bitmap); + } return Status; }