/** @file\r
+Implementation for EFI_HII_IMAGE_PROTOCOL.\r
\r
-Copyright (c) 2007, Intel Corporation\r
+\r
+Copyright (c) 2007 - 2008, Intel Corporation\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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Image.c\r
-\r
-Abstract:\r
+**/\r
\r
- Implementation for EFI_HII_IMAGE_PROTOCOL.\r
\r
-Revision History\r
+#include "HiiDatabase.h"\r
\r
\r
-**/\r
+/**\r
+ Get the imageid of last image block: EFI_HII_IIBT_END_BLOCK when input\r
+ ImageId is zero, otherwise return the address of the\r
+ corresponding image block with identifier specified by ImageId.\r
\r
+ This is a internal function.\r
\r
-#include "HiiDatabase.h"\r
+ @param ImageBlock Points to the beginning of a series of image blocks stored in order.\r
+ @param ImageId If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;\r
+ else use this id to find its corresponding image block address.\r
\r
-#ifndef DISABLE_UNUSED_HII_PROTOCOLS\r
+ @return The image block address when input ImageId is not zero; otherwise return NULL.\r
\r
-STATIC\r
+**/\r
UINT8*\r
GetImageIdOrAddress (\r
IN UINT8 *ImageBlock,\r
IN OUT EFI_IMAGE_ID *ImageId\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Get the imageid of last image block: EFI_HII_IIBT_END_BLOCK when input\r
- ImageId is zero, otherwise return the address of the\r
- corresponding image block with identifier specified by ImageId.\r
-\r
- Arguments:\r
- ImageBlock - Points to the beginning of a series of image blocks stored in order.\r
- ImageId - If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;\r
- else use this id to find its corresponding image block address.\r
-\r
- Returns:\r
- The image block address when input ImageId is not zero; otherwise return NULL.\r
-\r
---*/\r
{\r
EFI_IMAGE_ID ImageIdCurrent;\r
UINT8 *ImageBlockHdr;\r
/**\r
Convert pixels from EFI_GRAPHICS_OUTPUT_BLT_PIXEL to EFI_HII_RGB_PIXEL style.\r
\r
+ This is a internal function.\r
+\r
+\r
@param BitMapOut Pixels in EFI_HII_RGB_PIXEL format.\r
@param BitMapIn Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.\r
@param PixelNum The number of pixels to be converted.\r
\r
\r
**/\r
-STATIC\r
VOID\r
CopyGopToRgbPixel (\r
OUT EFI_HII_RGB_PIXEL *BitMapOut,\r
/**\r
Convert pixels from EFI_HII_RGB_PIXEL to EFI_GRAPHICS_OUTPUT_BLT_PIXEL style.\r
\r
+ This is a internal function.\r
+\r
+\r
@param BitMapOut Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.\r
@param BitMapIn Pixels in EFI_HII_RGB_PIXEL format.\r
@param PixelNum The number of pixels to be converted.\r
\r
\r
**/\r
-STATIC\r
VOID\r
CopyRgbToGopPixel (\r
OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapOut,\r
/**\r
Output pixels in "1 bit per pixel" format to an image.\r
\r
+ This is a internal function.\r
+\r
+\r
@param Image Points to the image which will store the pixels.\r
@param Data Stores the value of output pixels, 0 or 1.\r
@param PaletteInfo PaletteInfo which stores the color of the output\r
\r
\r
**/\r
-STATIC\r
VOID\r
Output1bitPixel (\r
IN OUT EFI_IMAGE_INPUT *Image,\r
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo\r
)\r
{\r
- UINT16 X;\r
- UINT16 Y;\r
+ UINT16 Xpos;\r
+ UINT16 Ypos;\r
UINTN OffsetY;\r
UINT8 Index;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;\r
ZeroMem (PaletteValue, sizeof (PaletteValue));\r
CopyRgbToGopPixel (&PaletteValue[0], &Palette->PaletteValue[0], 1);\r
CopyRgbToGopPixel (&PaletteValue[1], &Palette->PaletteValue[1], 1);\r
- SafeFreePool (Palette);\r
+ FreePool (Palette);\r
\r
//\r
// Convert the pixel from one bit to corresponding color.\r
//\r
- for (Y = 0; Y < Image->Height; Y++) {\r
- OffsetY = BITMAP_LEN_1_BIT (Image->Width, Y);\r
+ for (Ypos = 0; Ypos < Image->Height; Ypos++) {\r
+ OffsetY = BITMAP_LEN_1_BIT (Image->Width, Ypos);\r
//\r
// All bits in these bytes are meaningful\r
//\r
- for (X = 0; X < Image->Width / 8; X++) {\r
- Byte = *(Data + OffsetY + X);\r
+ for (Xpos = 0; Xpos < Image->Width / 8; Xpos++) {\r
+ Byte = *(Data + OffsetY + Xpos);\r
for (Index = 0; Index < 8; Index++) {\r
if ((Byte & (1 << Index)) != 0) {\r
- BitMapPtr[Y * Image->Width + X * 8 + (8 - Index - 1)] = PaletteValue[1];\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[1];\r
} else {\r
- BitMapPtr[Y * Image->Width + X * 8 + (8 - Index - 1)] = PaletteValue[0];\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[0];\r
}\r
}\r
}\r
//\r
// Padding bits in this byte should be ignored.\r
//\r
- Byte = *(Data + OffsetY + X);\r
+ Byte = *(Data + OffsetY + Xpos);\r
for (Index = 0; Index < Image->Width % 8; Index++) {\r
if ((Byte & (1 << (8 - Index - 1))) != 0) {\r
- BitMapPtr[Y * Image->Width + X * 8 + Index] = PaletteValue[1];\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[1];\r
} else {\r
- BitMapPtr[Y * Image->Width + X * 8 + Index] = PaletteValue[0];\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[0];\r
}\r
}\r
}\r
/**\r
Output pixels in "4 bit per pixel" format to an image.\r
\r
+ This is a internal function.\r
+\r
+\r
@param Image Points to the image which will store the pixels.\r
@param Data Stores the value of output pixels, 0 ~ 15.\r
- @param PaletteInfo PaletteInfo which stores the color of the output\r
+ @param[in] PaletteInfo PaletteInfo which stores the color of the output\r
pixels. Each entry corresponds to a color within\r
[0, 15].\r
\r
\r
**/\r
-STATIC\r
VOID\r
Output4bitPixel (\r
IN OUT EFI_IMAGE_INPUT *Image,\r
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo\r
)\r
{\r
- UINT16 X;\r
- UINT16 Y;\r
+ UINT16 Xpos;\r
+ UINT16 Ypos;\r
UINTN OffsetY;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[16];\r
\r
ZeroMem (PaletteValue, sizeof (PaletteValue));\r
CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum);\r
- SafeFreePool (Palette);\r
+ FreePool (Palette);\r
\r
//\r
// Convert the pixel from 4 bit to corresponding color.\r
//\r
- for (Y = 0; Y < Image->Height; Y++) {\r
- OffsetY = BITMAP_LEN_4_BIT (Image->Width, Y);\r
+ for (Ypos = 0; Ypos < Image->Height; Ypos++) {\r
+ OffsetY = BITMAP_LEN_4_BIT (Image->Width, Ypos);\r
//\r
// All bits in these bytes are meaningful\r
//\r
- for (X = 0; X < Image->Width / 2; X++) {\r
- Byte = *(Data + OffsetY + X);\r
- BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4];\r
- BitMapPtr[Y * Image->Width + X * 2 + 1] = PaletteValue[Byte & 0x0F];\r
+ for (Xpos = 0; Xpos < Image->Width / 2; Xpos++) {\r
+ Byte = *(Data + OffsetY + Xpos);\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1] = PaletteValue[Byte & 0x0F];\r
}\r
\r
if (Image->Width % 2 != 0) {\r
//\r
// Padding bits in this byte should be ignored.\r
//\r
- Byte = *(Data + OffsetY + X);\r
- BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4];\r
+ Byte = *(Data + OffsetY + Xpos);\r
+ BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];\r
}\r
}\r
}\r
/**\r
Output pixels in "8 bit per pixel" format to an image.\r
\r
+ This is a internal function.\r
+\r
+\r
@param Image Points to the image which will store the pixels.\r
@param Data Stores the value of output pixels, 0 ~ 255.\r
- @param PaletteInfo PaletteInfo which stores the color of the output\r
+ @param[in] PaletteInfo PaletteInfo which stores the color of the output\r
pixels. Each entry corresponds to a color within\r
[0, 255].\r
\r
\r
**/\r
-STATIC\r
VOID\r
Output8bitPixel (\r
IN OUT EFI_IMAGE_INPUT *Image,\r
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo\r
)\r
{\r
- UINT16 X;\r
- UINT16 Y;\r
+ UINT16 Xpos;\r
+ UINT16 Ypos;\r
UINTN OffsetY;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[256];\r
PaletteNum = (UINT16)(Palette->PaletteSize / sizeof (EFI_HII_RGB_PIXEL));\r
ZeroMem (PaletteValue, sizeof (PaletteValue));\r
CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum);\r
- SafeFreePool (Palette);\r
+ FreePool (Palette);\r
\r
//\r
// Convert the pixel from 8 bits to corresponding color.\r
//\r
- for (Y = 0; Y < Image->Height; Y++) {\r
- OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y);\r
+ for (Ypos = 0; Ypos < Image->Height; Ypos++) {\r
+ OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos);\r
//\r
// All bits are meaningful since the bitmap is 8 bits per pixel.\r
//\r
- for (X = 0; X < Image->Width; X++) {\r
- Byte = *(Data + OffsetY + X);\r
- BitMapPtr[OffsetY + X] = PaletteValue[Byte];\r
+ for (Xpos = 0; Xpos < Image->Width; Xpos++) {\r
+ Byte = *(Data + OffsetY + Xpos);\r
+ BitMapPtr[OffsetY + Xpos] = PaletteValue[Byte];\r
}\r
}\r
\r
/**\r
Output pixels in "24 bit per pixel" format to an image.\r
\r
+ This is a internal function.\r
+\r
+\r
@param Image Points to the image which will store the pixels.\r
@param Data Stores the color of output pixels, allowing 16.8\r
millions colors.\r
\r
\r
**/\r
-STATIC\r
VOID\r
Output24bitPixel (\r
IN OUT EFI_IMAGE_INPUT *Image,\r
IN EFI_HII_RGB_PIXEL *Data\r
)\r
{\r
- UINT16 Y;\r
+ UINT16 Ypos;\r
UINTN OffsetY;\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;\r
\r
\r
BitMapPtr = Image->Bitmap;\r
\r
- for (Y = 0; Y < Image->Height; Y++) {\r
- OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y);\r
+ for (Ypos = 0; Ypos < Image->Height; Ypos++) {\r
+ OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos);\r
CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width);\r
}\r
\r
/**\r
Convert the image from EFI_IMAGE_INPUT to EFI_IMAGE_OUTPUT format.\r
\r
+ This is a internal function.\r
+\r
+\r
@param BltBuffer Buffer points to bitmap data of incoming image.\r
+ @param BltX Specifies the offset from the left and top edge of\r
+ the output image of the first pixel in the image.\r
@param BltY Specifies the offset from the left and top edge of\r
the output image of the first pixel in the image.\r
@param Width Width of the incoming image, in pixels.\r
@retval EFI_INVALID_PARAMETER Any incoming parameter is invalid.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
ImageToBlt (\r
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,\r
)\r
{\r
EFI_IMAGE_OUTPUT *ImageOut;\r
- UINTN X;\r
- UINTN Y;\r
+ UINTN Xpos;\r
+ UINTN Ypos;\r
UINTN OffsetY1; // src buffer\r
UINTN OffsetY2; // dest buffer\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL SrcPixel;\r
\r
ZeroMem (&ZeroPixel, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
\r
- for (Y = 0; Y < Height; Y++) {\r
- OffsetY1 = Width * Y;\r
- OffsetY2 = ImageOut->Width * (BltY + Y);\r
- for (X = 0; X < Width; X++) {\r
- SrcPixel = BltBuffer[OffsetY1 + X];\r
+ for (Ypos = 0; Ypos < Height; Ypos++) {\r
+ OffsetY1 = Width * Ypos;\r
+ OffsetY2 = ImageOut->Width * (BltY + Ypos);\r
+ for (Xpos = 0; Xpos < Width; Xpos++) {\r
+ SrcPixel = BltBuffer[OffsetY1 + Xpos];\r
if (Transparent) {\r
if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) {\r
- ImageOut->Image.Bitmap[OffsetY2 + BltX + X] = SrcPixel;\r
+ ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;\r
}\r
} else {\r
- ImageOut->Image.Bitmap[OffsetY2 + BltX + X] = SrcPixel;\r
+ ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;\r
}\r
}\r
}\r
UINTN NewBlockSize;\r
EFI_IMAGE_INPUT *ImageIn;\r
\r
- if (This == NULL || ImageId == NULL || Image == NULL || PackageList == NULL) {\r
+ if (This == NULL || ImageId == NULL || Image == NULL || Image->Bitmap == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
ImagePackage->ImageBlock,\r
ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK)\r
);\r
- SafeFreePool (ImagePackage->ImageBlock);\r
+ FreePool (ImagePackage->ImageBlock);\r
ImagePackage->ImageBlock = ImageBlock;\r
ImageBlock += ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK);\r
//\r
//\r
NewBlock = AllocateZeroPool (NewBlockSize);\r
if (NewBlock == NULL) {\r
- SafeFreePool (ImagePackage->ImageBlock);\r
- ImagePackage->ImageBlock = NULL;\r
+ FreePool (ImagePackage->ImageBlock);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
NewBlockPtr = NewBlock;\r
ImagePackage->ImageBlockSize = (UINT32) BlockSize;\r
ImagePackage->ImageBlock = (UINT8 *) AllocateZeroPool (BlockSize);\r
if (ImagePackage->ImageBlock == NULL) {\r
- SafeFreePool (ImagePackage);\r
+ FreePool (ImagePackage);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
ImageBlock = ImagePackage->ImageBlock;\r
//\r
NewBlock = AllocateZeroPool (NewBlockSize);\r
if (NewBlock == NULL) {\r
- SafeFreePool (ImagePackage->ImageBlock);\r
- SafeFreePool (ImagePackage);\r
+ FreePool (ImagePackage->ImageBlock);\r
+ FreePool (ImagePackage);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
NewBlockPtr = NewBlock;\r
CopyGopToRgbPixel ((EFI_HII_RGB_PIXEL *) NewBlock, ImageIn->Bitmap, ImageIn->Width * ImageIn->Height);\r
\r
CopyMem (ImageBlock, NewBlockPtr, NewBlockSize);\r
- SafeFreePool (NewBlockPtr);\r
+ FreePool (NewBlockPtr);\r
\r
//\r
// Append the block end\r
@param ImageId The image's id,, which is unique within\r
PackageList.\r
@param Image Points to the image.\r
- @param ImageSize On entry, points to the size of the buffer pointed\r
- to by Image, in bytes. On return, points to the\r
- length of the image, in bytes.\r
\r
@retval EFI_SUCCESS The new image was returned successfully.\r
- @retval EFI_NOT_FOUND The image specified by ImageId is not available.\r
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the\r
+ database. The specified PackageList is not in the database.\r
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to\r
hold the image.\r
@retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.\r
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not\r
+ enough memory.\r
\r
**/\r
EFI_STATUS\r
IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
IN EFI_HII_HANDLE PackageList,\r
IN EFI_IMAGE_ID ImageId,\r
- OUT EFI_IMAGE_INPUT *Image,\r
- OUT UINTN *ImageSize\r
+ OUT EFI_IMAGE_INPUT *Image\r
)\r
{\r
HII_DATABASE_PRIVATE_DATA *Private;\r
UINT8 PaletteIndex;\r
UINT16 PaletteSize;\r
\r
- if (This == NULL || ImageSize == NULL || Image == NULL || ImageId < 1 || PackageList == NULL) {\r
+ if (This == NULL || Image == NULL || ImageId < 1) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
// Use the common block code since the definition of these structures is the same.\r
//\r
CopyMem (&Iibt1bit, ImageBlock, sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK));\r
- ImageLength = sizeof (EFI_IMAGE_INPUT) + sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *\r
- (Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height - 1);\r
- if (*ImageSize < ImageLength) {\r
- *ImageSize = ImageLength;\r
- return EFI_BUFFER_TOO_SMALL;\r
+ ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *\r
+ (Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height);\r
+ Image->Bitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (ImageLength);\r
+ if (Image->Bitmap == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
}\r
- ZeroMem (Image, ImageLength);\r
\r
if (Flag) {\r
Image->Flags = EFI_IMAGE_TRANSPARENT;\r
ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT16),\r
sizeof (UINT16)\r
);\r
- ImageLength = sizeof (EFI_IMAGE_INPUT) +\r
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * (Width * Height - 1);\r
- if (*ImageSize < ImageLength) {\r
- *ImageSize = ImageLength;\r
- return EFI_BUFFER_TOO_SMALL;\r
+ ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * (Width * Height);\r
+ Image->Bitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (ImageLength);\r
+ if (Image->Bitmap == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
}\r
- ZeroMem (Image, ImageLength);\r
\r
if (Flag) {\r
Image->Flags = EFI_IMAGE_TRANSPARENT;\r
\r
@retval EFI_SUCCESS The new image was updated successfully.\r
@retval EFI_NOT_FOUND The image specified by ImageId is not in the\r
- database.\r
+ database. The specified PackageList is not in the database. \r
@retval EFI_INVALID_PARAMETER The Image was NULL.\r
\r
**/\r
UINT32 Part1Size;\r
UINT32 Part2Size;\r
\r
- if (This == NULL || Image == NULL || ImageId < 1 || PackageList == NULL) {\r
+ if (This == NULL || Image == NULL || ImageId < 1 || Image->Bitmap == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
BlockSize = ImagePackage->ImageBlockSize + NewBlockSize - OldBlockSize;\r
Block = (UINT8 *) AllocateZeroPool (BlockSize);\r
if (Block == NULL) {\r
- SafeFreePool (NewBlock);\r
+ FreePool (NewBlock);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
BlockPtr += NewBlockSize;\r
CopyMem (BlockPtr, ImageBlock + OldBlockSize, Part2Size);\r
\r
- SafeFreePool (ImagePackage->ImageBlock);\r
- SafeFreePool (NewBlock);\r
+ FreePool (ImagePackage->ImageBlock);\r
+ FreePool (NewBlock);\r
ImagePackage->ImageBlock = Block;\r
ImagePackage->ImageBlockSize = BlockSize;\r
ImagePackage->ImagePkgHdr.Header.Length += NewBlockSize - OldBlockSize;\r
will be allocated to hold the generated image and\r
the pointer updated on exit. It is the caller's\r
responsibility to free this buffer.\r
+ @param BltX Specifies the offset from the left and top edge of\r
+ the output image of the first pixel in the image.\r
@param BltY Specifies the offset from the left and top edge of\r
the output image of the first pixel in the image.\r
\r
UINTN BufferLen;\r
UINTN Width;\r
UINTN Height;\r
- UINTN X;\r
- UINTN Y;\r
+ UINTN Xpos;\r
+ UINTN Ypos;\r
UINTN OffsetY1;\r
UINTN OffsetY2;\r
EFI_FONT_DISPLAY_INFO *FontInfo;\r
if (Width == ImageIn->Width && Height == ImageIn->Height) {\r
CopyMem (BltBuffer, ImageIn->Bitmap, BufferLen);\r
} else {\r
- for (Y = 0; Y < Height; Y++) {\r
- OffsetY1 = ImageIn->Width * Y;\r
- OffsetY2 = Width * Y;\r
- for (X = 0; X < Width; X++) {\r
- BltBuffer[OffsetY2 + X] = ImageIn->Bitmap[OffsetY1 + X];\r
+ for (Ypos = 0; Ypos < Height; Ypos++) {\r
+ OffsetY1 = ImageIn->Width * Ypos;\r
+ OffsetY2 = Width * Ypos;\r
+ for (Xpos = 0; Xpos < Width; Xpos++) {\r
+ BltBuffer[OffsetY2 + Xpos] = ImageIn->Bitmap[OffsetY1 + Xpos];\r
}\r
}\r
}\r
\r
}\r
\r
- SafeFreePool (BltBuffer);\r
+ FreePool (BltBuffer);\r
return Status;\r
\r
} else {\r
\r
ImageOut = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));\r
if (ImageOut == NULL) {\r
- SafeFreePool (BltBuffer);\r
+ FreePool (BltBuffer);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
ImageOut->Width = (UINT16) Width;\r
//\r
Status = GetSystemFont (Private, &FontInfo, NULL);\r
if (EFI_ERROR (Status)) {\r
- SafeFreePool (BltBuffer);\r
- SafeFreePool (ImageOut);\r
+ FreePool (BltBuffer);\r
+ FreePool (ImageOut);\r
return Status;\r
}\r
for (Index = 0; Index < Width * Height; Index++) {\r
BltBuffer[Index] = FontInfo->BackgroundColor;\r
}\r
- SafeFreePool (FontInfo);\r
+ FreePool (FontInfo);\r
\r
//\r
// Draw the incoming image to the new created image.\r
allocated to hold the generated image and the\r
pointer updated on exit. It is the caller's\r
responsibility to free this buffer.\r
+ @param BltX Specifies the offset from the left and top edge of\r
+ the output image of the first pixel in the image.\r
@param BltY Specifies the offset from the left and top edge of\r
the output image of the first pixel in the image.\r
\r
@retval EFI_SUCCESS The image was successfully drawn.\r
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.\r
- @retval EFI_INVALID_PARAMETER The Image was NULL.\r
- @retval EFI_NOT_FOUND The specified packagelist could not be found in\r
- current database.\r
+ @retval EFI_INVALID_PARAMETER The Blt was NULL.\r
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database. \r
+ The specified PackageList is not in the database. \r
\r
**/\r
EFI_STATUS\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_IMAGE_INPUT ImageTemp;\r
- EFI_IMAGE_INPUT *Image;\r
- UINTN ImageSize;\r
+ EFI_IMAGE_INPUT Image;\r
\r
//\r
// Check input parameter.\r
//\r
- if (This == NULL || PackageList == NULL || Blt == NULL || PackageList == NULL) {\r
+ if (This == NULL || Blt == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
// Get the specified Image.\r
//\r
- ImageSize = 0;\r
- Status = HiiGetImage (This, PackageList, ImageId, &ImageTemp, &ImageSize);\r
- if (Status != EFI_BUFFER_TOO_SMALL) {\r
+ Status = HiiGetImage (This, PackageList, ImageId, &Image);\r
+ if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- Image = (EFI_IMAGE_INPUT *) AllocateZeroPool (ImageSize);\r
- if (Image == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- Status = HiiGetImage (This, PackageList, ImageId, Image, &ImageSize);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Draw this image.\r
//\r
- Status = HiiDrawImage (This, Flags, Image, Blt, BltX, BltY);\r
- SafeFreePool (Image);\r
+ Status = HiiDrawImage (This, Flags, &Image, Blt, BltX, BltY);\r
+ if (Image.Bitmap != NULL) {\r
+ FreePool (Image.Bitmap);\r
+ }\r
return Status;\r
}\r
\r
-#endif\r
-\r