summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe/Image.c')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Image.c117
1 files changed, 61 insertions, 56 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index ab8f056..ae5eff7 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -242,19 +242,19 @@ Output1bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
)
{
- UINT16 Xpos;
- UINT16 Ypos;
- UINTN OffsetY;
- UINT8 Index;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[2];
- EFI_HII_IMAGE_PALETTE_INFO *Palette;
- UINTN PaletteSize;
- UINT8 Byte;
+ UINT16 Xpos;
+ UINT16 Ypos;
+ UINTN OffsetY;
+ UINT8 Index;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *BitMapPtr;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION PaletteValue[2];
+ EFI_HII_IMAGE_PALETTE_INFO *Palette;
+ UINTN PaletteSize;
+ UINT8 Byte;
ASSERT (Image != NULL && Data != NULL && PaletteInfo != NULL);
- BitMapPtr = Image->Bitmap;
+ BitMapPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *)Image->Bitmap;
//
// First entry corresponds to color 0 and second entry corresponds to color 1.
@@ -271,8 +271,8 @@ Output1bitPixel (
CopyMem (Palette, PaletteInfo, PaletteSize);
ZeroMem (PaletteValue, sizeof (PaletteValue));
- CopyRgbToGopPixel (&PaletteValue[0], &Palette->PaletteValue[0], 1);
- CopyRgbToGopPixel (&PaletteValue[1], &Palette->PaletteValue[1], 1);
+ CopyRgbToGopPixel (&PaletteValue[0].Pixel, &Palette->PaletteValue[0], 1);
+ CopyRgbToGopPixel (&PaletteValue[1].Pixel, &Palette->PaletteValue[1], 1);
FreePool (Palette);
//
@@ -287,9 +287,9 @@ Output1bitPixel (
Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < 8; Index++) {
if ((Byte & (1 << Index)) != 0) {
- BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[1];
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)].Raw = PaletteValue[1].Raw;
} else {
- BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[0];
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)].Raw = PaletteValue[0].Raw;
}
}
}
@@ -301,9 +301,9 @@ Output1bitPixel (
Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < Image->Width % 8; Index++) {
if ((Byte & (1 << (8 - Index - 1))) != 0) {
- BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[1];
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index].Raw = PaletteValue[1].Raw;
} else {
- BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[0];
+ BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index].Raw = PaletteValue[0].Raw;
}
}
}
@@ -331,19 +331,19 @@ Output4bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
)
{
- UINT16 Xpos;
- UINT16 Ypos;
- UINTN OffsetY;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[16];
- EFI_HII_IMAGE_PALETTE_INFO *Palette;
- UINTN PaletteSize;
- UINT16 PaletteNum;
- UINT8 Byte;
+ UINT16 Xpos;
+ UINT16 Ypos;
+ UINTN OffsetY;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *BitMapPtr;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION PaletteValue[16];
+ EFI_HII_IMAGE_PALETTE_INFO *Palette;
+ UINTN PaletteSize;
+ UINT16 PaletteNum;
+ UINT8 Byte;
ASSERT (Image != NULL && Data != NULL && PaletteInfo != NULL);
- BitMapPtr = Image->Bitmap;
+ BitMapPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *)Image->Bitmap;
//
// The bitmap should allocate each color index starting from 0.
@@ -361,7 +361,7 @@ Output4bitPixel (
PaletteNum = (UINT16)(Palette->PaletteSize / sizeof (EFI_HII_RGB_PIXEL));
ZeroMem (PaletteValue, sizeof (PaletteValue));
- CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, MIN (PaletteNum, ARRAY_SIZE (PaletteValue)));
+ CopyRgbToGopPixel (&PaletteValue->Pixel, Palette->PaletteValue, MIN (PaletteNum, ARRAY_SIZE (PaletteValue)));
FreePool (Palette);
//
@@ -373,17 +373,17 @@ Output4bitPixel (
// All bits in these bytes are meaningful
//
for (Xpos = 0; Xpos < Image->Width / 2; Xpos++) {
- Byte = *(Data + OffsetY + Xpos);
- BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
- BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1] = PaletteValue[Byte & 0x0F];
+ Byte = *(Data + OffsetY + Xpos);
+ BitMapPtr[Ypos * Image->Width + Xpos * 2].Raw = PaletteValue[Byte >> 4].Raw;
+ BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1].Raw = PaletteValue[Byte & 0x0F].Raw;
}
if (Image->Width % 2 != 0) {
//
// Padding bits in this byte should be ignored.
//
- Byte = *(Data + OffsetY + Xpos);
- BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
+ Byte = *(Data + OffsetY + Xpos);
+ BitMapPtr[Ypos * Image->Width + Xpos * 2].Raw = PaletteValue[Byte >> 4].Raw;
}
}
}
@@ -409,19 +409,19 @@ Output8bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
)
{
- UINT16 Xpos;
- UINT16 Ypos;
- UINTN OffsetY;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[256];
- EFI_HII_IMAGE_PALETTE_INFO *Palette;
- UINTN PaletteSize;
- UINT16 PaletteNum;
- UINT8 Byte;
+ UINT16 Xpos;
+ UINT16 Ypos;
+ UINTN OffsetY;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *BitMapPtr;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION PaletteValue[256];
+ EFI_HII_IMAGE_PALETTE_INFO *Palette;
+ UINTN PaletteSize;
+ UINT16 PaletteNum;
+ UINT8 Byte;
ASSERT (Image != NULL && Data != NULL && PaletteInfo != NULL);
- BitMapPtr = Image->Bitmap;
+ BitMapPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *)Image->Bitmap;
//
// The bitmap should allocate each color index starting from 0.
@@ -438,7 +438,7 @@ Output8bitPixel (
CopyMem (Palette, PaletteInfo, PaletteSize);
PaletteNum = (UINT16)(Palette->PaletteSize / sizeof (EFI_HII_RGB_PIXEL));
ZeroMem (PaletteValue, sizeof (PaletteValue));
- CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, MIN (PaletteNum, ARRAY_SIZE (PaletteValue)));
+ CopyRgbToGopPixel (&PaletteValue->Pixel, Palette->PaletteValue, MIN (PaletteNum, ARRAY_SIZE (PaletteValue)));
FreePool (Palette);
//
@@ -450,8 +450,8 @@ Output8bitPixel (
// All bits are meaningful since the bitmap is 8 bits per pixel.
//
for (Xpos = 0; Xpos < Image->Width; Xpos++) {
- Byte = *(Data + OffsetY + Xpos);
- BitMapPtr[OffsetY + Xpos] = PaletteValue[Byte];
+ Byte = *(Data + OffsetY + Xpos);
+ BitMapPtr[OffsetY + Xpos].Raw = PaletteValue[Byte].Raw;
}
}
}
@@ -521,13 +521,15 @@ ImageToBlt (
IN OUT EFI_IMAGE_OUTPUT **Blt
)
{
- EFI_IMAGE_OUTPUT *ImageOut;
- UINTN Xpos;
- UINTN Ypos;
- UINTN OffsetY1; // src buffer
- UINTN OffsetY2; // dest buffer
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL SrcPixel;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL ZeroPixel;
+ EFI_IMAGE_OUTPUT *ImageOut;
+ UINTN Xpos;
+ UINTN Ypos;
+ UINTN OffsetY1; // src buffer
+ UINTN OffsetY2; // dest buffer
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION SrcPixel;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION ZeroPixel;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *BltBufferPixel;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *ImageBitmap;
if ((BltBuffer == NULL) || (Blt == NULL) || (*Blt == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -545,17 +547,20 @@ ImageToBlt (
ZeroMem (&ZeroPixel, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+ BltBufferPixel = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *)BltBuffer;
+ ImageBitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *)ImageOut->Image.Bitmap;
+
for (Ypos = 0; Ypos < Height; Ypos++) {
OffsetY1 = Width * Ypos;
OffsetY2 = ImageOut->Width * (BltY + Ypos);
for (Xpos = 0; Xpos < Width; Xpos++) {
- SrcPixel = BltBuffer[OffsetY1 + Xpos];
+ SrcPixel.Raw = BltBufferPixel[OffsetY1 + Xpos].Raw;
if (Transparent) {
if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) {
- ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
+ ImageBitmap[OffsetY2 + BltX + Xpos].Raw = SrcPixel.Raw;
}
} else {
- ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
+ ImageBitmap[OffsetY2 + BltX + Xpos].Raw = SrcPixel.Raw;
}
}
}
@@ -1402,7 +1407,7 @@ HiiDrawImage (
//
if ((Flags & EFI_HII_DIRECT_TO_SCREEN) == EFI_HII_DIRECT_TO_SCREEN) {
//
- // Caller should make sure the current UGA console is grarphic mode.
+ // Caller should make sure the current console is grarphic mode.
//
//