diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-09-21 12:55:00 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-09-28 16:21:58 +0800 |
commit | c0c7d58d367fb185ce6a2c109fcc965b42ae77d8 (patch) | |
tree | d264f1a9d724ba1d6ab1e085a86c94eef7bdb44e /MdeModulePkg | |
parent | 8ba839630e0ea5dceda12572ffc1db1cc4345851 (diff) | |
download | edk2-c0c7d58d367fb185ce6a2c109fcc965b42ae77d8.tar.gz edk2-c0c7d58d367fb185ce6a2c109fcc965b42ae77d8.tar.bz2 edk2-c0c7d58d367fb185ce6a2c109fcc965b42ae77d8.zip |
MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG
1. Update GetImageIdOrAddress() to recognize PNG/JPEG image block.
A offset calculation bug was fixed.
2. Update HiiGetImage() comments to say PNG/JPEG support is provided
by HiiImageEx
3. Update HiiSetImage() to support replacing a PNG/JPEG image block
with a new image
Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c index e5eb677dbf..c8e9258ba6 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c @@ -127,7 +127,12 @@ GetImageIdOrAddress ( break;
case EFI_HII_IIBT_IMAGE_JPEG:
- Length = ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ Length = OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ ImageIdCurrent++;
+ break;
+
+ case EFI_HII_IIBT_IMAGE_PNG:
+ Length = OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size);
ImageIdCurrent++;
break;
@@ -842,8 +847,10 @@ HiiGetImage ( switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
+ case EFI_HII_IIBT_IMAGE_PNG:
//
- // BUGBUG: need to be supported as soon as image tool is designed.
+ // HiiImage protocol doesn't support return JPEG/PNG.
+ // Use HiiImageEx instead.
//
return EFI_UNSUPPORTED;
@@ -1005,11 +1012,11 @@ HiiSetImage ( //
switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
- //
- // BUGBUG: need to be supported as soon as image tool is designed.
- //
- return EFI_UNSUPPORTED;
-
+ OldBlockSize = OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ break;
+ case EFI_HII_IIBT_IMAGE_PNG:
+ OldBlockSize = OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size);
+ break;
case EFI_HII_IIBT_IMAGE_1BIT:
case EFI_HII_IIBT_IMAGE_1BIT_TRANS:
OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8) +
|