From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F232A1A20CE for ; Fri, 23 Sep 2016 01:25:34 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 23 Sep 2016 01:25:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,381,1470726000"; d="scan'208";a="172311858" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 23 Sep 2016 01:25:33 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Liming Gao , Eric Dong , Dandan Bi Date: Fri, 23 Sep 2016 16:25:16 +0800 Message-Id: <20160923082521.99872-9-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20160923082521.99872-1-ruiyu.ni@intel.com> References: <20160923082521.99872-1-ruiyu.ni@intel.com> Subject: [PATCH 08/13] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2016 08:25:35 -0000 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 Cc: Eric Dong Cc: Dandan Bi Signed-off-by: Ruiyu Ni --- 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