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 185DF1A1E2F for ; Mon, 26 Sep 2016 02:30:53 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP; 26 Sep 2016 02:30:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,398,1470726000"; d="scan'208";a="13208379" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga006.fm.intel.com with ESMTP; 26 Sep 2016 02:30:51 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Liming Gao , Eric Dong , Dandan Bi Date: Mon, 26 Sep 2016 17:30:25 +0800 Message-Id: <20160926093035.350612-10-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20160926093035.350612-1-ruiyu.ni@intel.com> References: <20160926093035.350612-1-ruiyu.ni@intel.com> Subject: [PATCH v2 09/19] 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: Mon, 26 Sep 2016 09:30:53 -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 e5eb677..c8e9258 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) + -- 2.9.0.windows.1