/** @file\r
\r
-Copyright (c) 2007, Intel Corporation\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
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
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
\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
+ SafeFreePool (Image.Bitmap);\r
return Status;\r
}\r
\r