From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
Eric Dong <eric.dong@intel.com>, Dandan Bi <dandan.bi@intel.com>
Subject: [PATCH 08/13] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG
Date: Fri, 23 Sep 2016 16:25:16 +0800 [thread overview]
Message-ID: <20160923082521.99872-9-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160923082521.99872-1-ruiyu.ni@intel.com>
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
Cc: 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>
---
MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 8335252..6d70193 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 (&((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ Length = OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + ReadUnaligned32 (&((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 (&((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 = ReadUnaligned32 (&((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ break;
+ case EFI_HII_IIBT_IMAGE_PNG:
+ OldBlockSize = ReadUnaligned32 (&((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) +
--
2.9.0.windows.1
next prev parent reply other threads:[~2016-09-23 8:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 8:25 [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Ruiyu Ni
2016-09-23 8:25 ` [PATCH 01/13] MdeModulePkg/HiiDatabase: Refine GetImageIdOrAddress Ruiyu Ni
2016-09-23 8:25 ` [PATCH 02/13] MdeModulePkg/HiiDatabase: Move common code to LocatePackageList() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 03/13] MdeModulePkg/HiiDatabase: Refine HiiNewImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 04/13] MdeModulePkg/HiiDatabase: Refine HiiGetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 05/13] MdeModulePkg/HiiDatabase: Refine HiiSetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 06/13] MdeModulePkg/HiiDatabase: Refine HiiDrawImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 07/13] MdemodulePkg/HiiDatabase: Correct typo in comments Ruiyu Ni
2016-09-23 8:25 ` Ruiyu Ni [this message]
2016-09-23 8:25 ` [PATCH 09/13] MdeModulePkg/HiiDatabase: Add HiiImageEx implementation Ruiyu Ni
2016-09-23 8:25 ` [PATCH 10/13] Nt32Pkg/PlatformBds: Do not call BootLogoEnableLogo Ruiyu Ni
2016-09-23 8:25 ` [PATCH 11/13] MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters Ruiyu Ni
2016-09-23 8:25 ` [PATCH 12/13] MdeModulePkg/Logo: Add LogoDxe module Ruiyu Ni
2016-09-23 8:25 ` [PATCH 13/13] Nt32Pkg: Use the new LogoDxe driver Ruiyu Ni
2016-09-26 2:55 ` [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160923082521.99872-9-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox