MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@ -15,23 +15,23 @@
|
||||
#include <Library/FrameBufferBltLib.h>
|
||||
|
||||
struct FRAME_BUFFER_CONFIGURE {
|
||||
UINT32 PixelsPerScanLine;
|
||||
UINT32 BytesPerPixel;
|
||||
UINT32 Width;
|
||||
UINT32 Height;
|
||||
UINT8 *FrameBuffer;
|
||||
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
|
||||
EFI_PIXEL_BITMASK PixelMasks;
|
||||
INT8 PixelShl[4]; // R-G-B-Rsvd
|
||||
INT8 PixelShr[4]; // R-G-B-Rsvd
|
||||
UINT8 LineBuffer[0];
|
||||
UINT32 PixelsPerScanLine;
|
||||
UINT32 BytesPerPixel;
|
||||
UINT32 Width;
|
||||
UINT32 Height;
|
||||
UINT8 *FrameBuffer;
|
||||
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
|
||||
EFI_PIXEL_BITMASK PixelMasks;
|
||||
INT8 PixelShl[4]; // R-G-B-Rsvd
|
||||
INT8 PixelShr[4]; // R-G-B-Rsvd
|
||||
UINT8 LineBuffer[0];
|
||||
};
|
||||
|
||||
CONST EFI_PIXEL_BITMASK mRgbPixelMasks = {
|
||||
CONST EFI_PIXEL_BITMASK mRgbPixelMasks = {
|
||||
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
|
||||
};
|
||||
|
||||
CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {
|
||||
CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {
|
||||
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
|
||||
};
|
||||
|
||||
@ -45,10 +45,10 @@ CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {
|
||||
**/
|
||||
VOID
|
||||
FrameBufferBltLibConfigurePixelFormat (
|
||||
IN CONST EFI_PIXEL_BITMASK *BitMask,
|
||||
OUT UINT32 *BytesPerPixel,
|
||||
OUT INT8 *PixelShl,
|
||||
OUT INT8 *PixelShr
|
||||
IN CONST EFI_PIXEL_BITMASK *BitMask,
|
||||
OUT UINT32 *BytesPerPixel,
|
||||
OUT INT8 *PixelShl,
|
||||
OUT INT8 *PixelShr
|
||||
)
|
||||
{
|
||||
UINT8 Index;
|
||||
@ -58,26 +58,34 @@ FrameBufferBltLibConfigurePixelFormat (
|
||||
ASSERT (BytesPerPixel != NULL);
|
||||
|
||||
MergedMasks = 0;
|
||||
Masks = (UINT32*) BitMask;
|
||||
Masks = (UINT32 *)BitMask;
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
ASSERT ((MergedMasks & Masks[Index]) == 0);
|
||||
|
||||
PixelShl[Index] = (INT8) HighBitSet32 (Masks[Index]) - 23 + (Index * 8);
|
||||
PixelShl[Index] = (INT8)HighBitSet32 (Masks[Index]) - 23 + (Index * 8);
|
||||
if (PixelShl[Index] < 0) {
|
||||
PixelShr[Index] = -PixelShl[Index];
|
||||
PixelShl[Index] = 0;
|
||||
} else {
|
||||
PixelShr[Index] = 0;
|
||||
}
|
||||
DEBUG ((DEBUG_INFO, "%d: shl:%d shr:%d mask:%x\n", Index,
|
||||
PixelShl[Index], PixelShr[Index], Masks[Index]));
|
||||
|
||||
MergedMasks = (UINT32) (MergedMasks | Masks[Index]);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%d: shl:%d shr:%d mask:%x\n",
|
||||
Index,
|
||||
PixelShl[Index],
|
||||
PixelShr[Index],
|
||||
Masks[Index]
|
||||
));
|
||||
|
||||
MergedMasks = (UINT32)(MergedMasks | Masks[Index]);
|
||||
}
|
||||
MergedMasks = (UINT32) (MergedMasks | Masks[3]);
|
||||
|
||||
MergedMasks = (UINT32)(MergedMasks | Masks[3]);
|
||||
|
||||
ASSERT (MergedMasks != 0);
|
||||
*BytesPerPixel = (UINT32) ((HighBitSet32 (MergedMasks) + 7) / 8);
|
||||
*BytesPerPixel = (UINT32)((HighBitSet32 (MergedMasks) + 7) / 8);
|
||||
DEBUG ((DEBUG_INFO, "Bytes per pixel: %d\n", *BytesPerPixel));
|
||||
}
|
||||
|
||||
@ -107,35 +115,35 @@ FrameBufferBltConfigure (
|
||||
IN OUT UINTN *ConfigureSize
|
||||
)
|
||||
{
|
||||
CONST EFI_PIXEL_BITMASK *BitMask;
|
||||
UINT32 BytesPerPixel;
|
||||
INT8 PixelShl[4];
|
||||
INT8 PixelShr[4];
|
||||
CONST EFI_PIXEL_BITMASK *BitMask;
|
||||
UINT32 BytesPerPixel;
|
||||
INT8 PixelShl[4];
|
||||
INT8 PixelShr[4];
|
||||
|
||||
if (ConfigureSize == NULL) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
switch (FrameBufferInfo->PixelFormat) {
|
||||
case PixelRedGreenBlueReserved8BitPerColor:
|
||||
BitMask = &mRgbPixelMasks;
|
||||
break;
|
||||
case PixelRedGreenBlueReserved8BitPerColor:
|
||||
BitMask = &mRgbPixelMasks;
|
||||
break;
|
||||
|
||||
case PixelBlueGreenRedReserved8BitPerColor:
|
||||
BitMask = &mBgrPixelMasks;
|
||||
break;
|
||||
case PixelBlueGreenRedReserved8BitPerColor:
|
||||
BitMask = &mBgrPixelMasks;
|
||||
break;
|
||||
|
||||
case PixelBitMask:
|
||||
BitMask = &FrameBufferInfo->PixelInformation;
|
||||
break;
|
||||
case PixelBitMask:
|
||||
BitMask = &FrameBufferInfo->PixelInformation;
|
||||
break;
|
||||
|
||||
case PixelBltOnly:
|
||||
ASSERT (FrameBufferInfo->PixelFormat != PixelBltOnly);
|
||||
return RETURN_UNSUPPORTED;
|
||||
case PixelBltOnly:
|
||||
ASSERT (FrameBufferInfo->PixelFormat != PixelBltOnly);
|
||||
return RETURN_UNSUPPORTED;
|
||||
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (FrameBufferInfo->PixelsPerScanLine < FrameBufferInfo->HorizontalResolution) {
|
||||
@ -145,9 +153,10 @@ FrameBufferBltConfigure (
|
||||
FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl, PixelShr);
|
||||
|
||||
if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE)
|
||||
+ FrameBufferInfo->HorizontalResolution * BytesPerPixel) {
|
||||
+ FrameBufferInfo->HorizontalResolution * BytesPerPixel)
|
||||
{
|
||||
*ConfigureSize = sizeof (FRAME_BUFFER_CONFIGURE)
|
||||
+ FrameBufferInfo->HorizontalResolution * BytesPerPixel;
|
||||
+ FrameBufferInfo->HorizontalResolution * BytesPerPixel;
|
||||
return RETURN_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
@ -155,12 +164,12 @@ FrameBufferBltConfigure (
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
CopyMem (&Configure->PixelMasks, BitMask, sizeof (*BitMask));
|
||||
CopyMem (Configure->PixelShl, PixelShl, sizeof (PixelShl));
|
||||
CopyMem (Configure->PixelShr, PixelShr, sizeof (PixelShr));
|
||||
CopyMem (&Configure->PixelMasks, BitMask, sizeof (*BitMask));
|
||||
CopyMem (Configure->PixelShl, PixelShl, sizeof (PixelShl));
|
||||
CopyMem (Configure->PixelShr, PixelShr, sizeof (PixelShr));
|
||||
Configure->BytesPerPixel = BytesPerPixel;
|
||||
Configure->PixelFormat = FrameBufferInfo->PixelFormat;
|
||||
Configure->FrameBuffer = (UINT8*) FrameBuffer;
|
||||
Configure->FrameBuffer = (UINT8 *)FrameBuffer;
|
||||
Configure->Width = FrameBufferInfo->HorizontalResolution;
|
||||
Configure->Height = FrameBufferInfo->VerticalResolution;
|
||||
Configure->PixelsPerScanLine = FrameBufferInfo->PixelsPerScanLine;
|
||||
@ -185,25 +194,25 @@ FrameBufferBltConfigure (
|
||||
**/
|
||||
EFI_STATUS
|
||||
FrameBufferBltLibVideoFill (
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Color,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Color,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height
|
||||
)
|
||||
{
|
||||
UINTN IndexX;
|
||||
UINTN IndexY;
|
||||
UINT8 *Destination;
|
||||
UINT8 Uint8;
|
||||
UINT32 Uint32;
|
||||
UINT64 WideFill;
|
||||
BOOLEAN UseWideFill;
|
||||
BOOLEAN LineBufferReady;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
UINTN SizeInBytes;
|
||||
UINTN IndexX;
|
||||
UINTN IndexY;
|
||||
UINT8 *Destination;
|
||||
UINT8 Uint8;
|
||||
UINT32 Uint32;
|
||||
UINT64 WideFill;
|
||||
BOOLEAN UseWideFill;
|
||||
BOOLEAN LineBufferReady;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
UINTN SizeInBytes;
|
||||
|
||||
//
|
||||
// BltBuffer to Video: Source is BltBuffer, destination is Video
|
||||
@ -218,25 +227,29 @@ FrameBufferBltLibVideoFill (
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
DEBUG ((DEBUG_VERBOSE, "VideoFill: Width or Height is 0\n"));
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
WidthInBytes = Width * Configure->BytesPerPixel;
|
||||
|
||||
Uint32 = *(UINT32*) Color;
|
||||
Uint32 = *(UINT32 *)Color;
|
||||
WideFill =
|
||||
(UINT32) (
|
||||
(((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &
|
||||
Configure->PixelMasks.RedMask) |
|
||||
(((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &
|
||||
Configure->PixelMasks.GreenMask) |
|
||||
(((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &
|
||||
Configure->PixelMasks.BlueMask)
|
||||
);
|
||||
DEBUG ((DEBUG_VERBOSE, "VideoFill: color=0x%x, wide-fill=0x%x\n",
|
||||
Uint32, WideFill));
|
||||
(UINT32)(
|
||||
(((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &
|
||||
Configure->PixelMasks.RedMask) |
|
||||
(((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &
|
||||
Configure->PixelMasks.GreenMask) |
|
||||
(((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &
|
||||
Configure->PixelMasks.BlueMask)
|
||||
);
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"VideoFill: color=0x%x, wide-fill=0x%x\n",
|
||||
Uint32,
|
||||
WideFill
|
||||
));
|
||||
|
||||
//
|
||||
// If the size of the pixel data evenly divides the sizeof
|
||||
@ -245,7 +258,7 @@ FrameBufferBltLibVideoFill (
|
||||
UseWideFill = TRUE;
|
||||
if ((sizeof (WideFill) % Configure->BytesPerPixel) == 0) {
|
||||
for (IndexX = Configure->BytesPerPixel; IndexX < sizeof (WideFill); IndexX++) {
|
||||
((UINT8*) &WideFill)[IndexX] = ((UINT8*) &WideFill)[IndexX % Configure->BytesPerPixel];
|
||||
((UINT8 *)&WideFill)[IndexX] = ((UINT8 *)&WideFill)[IndexX % Configure->BytesPerPixel];
|
||||
}
|
||||
} else {
|
||||
//
|
||||
@ -253,14 +266,16 @@ FrameBufferBltLibVideoFill (
|
||||
// a wide fill operation.
|
||||
//
|
||||
for (
|
||||
IndexX = 1, Uint8 = ((UINT8*) &WideFill)[0];
|
||||
IndexX < Configure->BytesPerPixel;
|
||||
IndexX++) {
|
||||
if (Uint8 != ((UINT8*) &WideFill)[IndexX]) {
|
||||
IndexX = 1, Uint8 = ((UINT8 *)&WideFill)[0];
|
||||
IndexX < Configure->BytesPerPixel;
|
||||
IndexX++)
|
||||
{
|
||||
if (Uint8 != ((UINT8 *)&WideFill)[IndexX]) {
|
||||
UseWideFill = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (UseWideFill) {
|
||||
SetMem (&WideFill, sizeof (WideFill), Uint8);
|
||||
}
|
||||
@ -268,26 +283,27 @@ FrameBufferBltLibVideoFill (
|
||||
|
||||
if (UseWideFill && (DestinationX == 0) && (Width == Configure->PixelsPerScanLine)) {
|
||||
DEBUG ((DEBUG_VERBOSE, "VideoFill (wide, one-shot)\n"));
|
||||
Offset = DestinationY * Configure->PixelsPerScanLine;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Offset = DestinationY * Configure->PixelsPerScanLine;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Destination = Configure->FrameBuffer + Offset;
|
||||
SizeInBytes = WidthInBytes * Height;
|
||||
if (SizeInBytes >= 8) {
|
||||
SetMem32 (Destination, SizeInBytes & ~3, (UINT32) WideFill);
|
||||
SetMem32 (Destination, SizeInBytes & ~3, (UINT32)WideFill);
|
||||
Destination += SizeInBytes & ~3;
|
||||
SizeInBytes &= 3;
|
||||
}
|
||||
|
||||
if (SizeInBytes > 0) {
|
||||
SetMem (Destination, SizeInBytes, (UINT8) (UINTN) WideFill);
|
||||
SetMem (Destination, SizeInBytes, (UINT8)(UINTN)WideFill);
|
||||
}
|
||||
} else {
|
||||
LineBufferReady = FALSE;
|
||||
for (IndexY = DestinationY; IndexY < (Height + DestinationY); IndexY++) {
|
||||
Offset = (IndexY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Offset = (IndexY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Destination = Configure->FrameBuffer + Offset;
|
||||
|
||||
if (UseWideFill && (((UINTN) Destination & 7) == 0)) {
|
||||
if (UseWideFill && (((UINTN)Destination & 7) == 0)) {
|
||||
DEBUG ((DEBUG_VERBOSE, "VideoFill (wide)\n"));
|
||||
SizeInBytes = WidthInBytes;
|
||||
if (SizeInBytes >= 8) {
|
||||
@ -295,6 +311,7 @@ FrameBufferBltLibVideoFill (
|
||||
Destination += SizeInBytes & ~7;
|
||||
SizeInBytes &= 7;
|
||||
}
|
||||
|
||||
if (SizeInBytes > 0) {
|
||||
CopyMem (Destination, &WideFill, SizeInBytes);
|
||||
}
|
||||
@ -307,11 +324,13 @@ FrameBufferBltLibVideoFill (
|
||||
(Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)),
|
||||
Configure->LineBuffer,
|
||||
MIN (IndexX, Width - IndexX) * Configure->BytesPerPixel
|
||||
);
|
||||
);
|
||||
IndexX += MIN (IndexX, Width - IndexX);
|
||||
}
|
||||
|
||||
LineBufferReady = TRUE;
|
||||
}
|
||||
|
||||
CopyMem (Destination, Configure->LineBuffer, WidthInBytes);
|
||||
}
|
||||
}
|
||||
@ -340,26 +359,26 @@ FrameBufferBltLibVideoFill (
|
||||
**/
|
||||
RETURN_STATUS
|
||||
FrameBufferBltLibVideoToBltBuffer (
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
)
|
||||
{
|
||||
UINTN DstY;
|
||||
UINTN SrcY;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN IndexX;
|
||||
UINT32 Uint32;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
UINTN DstY;
|
||||
UINTN SrcY;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN IndexX;
|
||||
UINT32 Uint32;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
|
||||
//
|
||||
// Video to BltBuffer: Source is Video, destination is BltBuffer
|
||||
@ -372,7 +391,7 @@ FrameBufferBltLibVideoToBltBuffer (
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -392,14 +411,14 @@ FrameBufferBltLibVideoToBltBuffer (
|
||||
//
|
||||
for (SrcY = SourceY, DstY = DestinationY;
|
||||
DstY < (Height + DestinationY);
|
||||
SrcY++, DstY++) {
|
||||
|
||||
SrcY++, DstY++)
|
||||
{
|
||||
Offset = (SrcY * Configure->PixelsPerScanLine) + SourceX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Source = Configure->FrameBuffer + Offset;
|
||||
|
||||
if (Configure->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
|
||||
Destination = (UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
Destination = (UINT8 *)BltBuffer + (DstY * Delta) + (DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
} else {
|
||||
Destination = Configure->LineBuffer;
|
||||
}
|
||||
@ -409,18 +428,18 @@ FrameBufferBltLibVideoToBltBuffer (
|
||||
if (Configure->PixelFormat != PixelBlueGreenRedReserved8BitPerColor) {
|
||||
for (IndexX = 0; IndexX < Width; IndexX++) {
|
||||
Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)
|
||||
((UINT8 *) BltBuffer + (DstY * Delta) +
|
||||
(DestinationX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
Uint32 = *(UINT32*) (Configure->LineBuffer + (IndexX * Configure->BytesPerPixel));
|
||||
*(UINT32*) Blt =
|
||||
(UINT32) (
|
||||
(((Uint32 & Configure->PixelMasks.RedMask) >>
|
||||
Configure->PixelShl[0]) << Configure->PixelShr[0]) |
|
||||
(((Uint32 & Configure->PixelMasks.GreenMask) >>
|
||||
Configure->PixelShl[1]) << Configure->PixelShr[1]) |
|
||||
(((Uint32 & Configure->PixelMasks.BlueMask) >>
|
||||
Configure->PixelShl[2]) << Configure->PixelShr[2])
|
||||
);
|
||||
((UINT8 *)BltBuffer + (DstY * Delta) +
|
||||
(DestinationX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
Uint32 = *(UINT32 *)(Configure->LineBuffer + (IndexX * Configure->BytesPerPixel));
|
||||
*(UINT32 *)Blt =
|
||||
(UINT32)(
|
||||
(((Uint32 & Configure->PixelMasks.RedMask) >>
|
||||
Configure->PixelShl[0]) << Configure->PixelShr[0]) |
|
||||
(((Uint32 & Configure->PixelMasks.GreenMask) >>
|
||||
Configure->PixelShl[1]) << Configure->PixelShr[1]) |
|
||||
(((Uint32 & Configure->PixelMasks.BlueMask) >>
|
||||
Configure->PixelShl[2]) << Configure->PixelShr[2])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -448,26 +467,26 @@ FrameBufferBltLibVideoToBltBuffer (
|
||||
**/
|
||||
RETURN_STATUS
|
||||
FrameBufferBltLibBufferToVideo (
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
)
|
||||
{
|
||||
UINTN DstY;
|
||||
UINTN SrcY;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN IndexX;
|
||||
UINT32 Uint32;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
UINTN DstY;
|
||||
UINTN SrcY;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN IndexX;
|
||||
UINT32 Uint32;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
|
||||
//
|
||||
// BltBuffer to Video: Source is BltBuffer, destination is Video
|
||||
@ -480,7 +499,7 @@ FrameBufferBltLibBufferToVideo (
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -497,33 +516,34 @@ FrameBufferBltLibBufferToVideo (
|
||||
|
||||
for (SrcY = SourceY, DstY = DestinationY;
|
||||
SrcY < (Height + SourceY);
|
||||
SrcY++, DstY++) {
|
||||
|
||||
Offset = (DstY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
SrcY++, DstY++)
|
||||
{
|
||||
Offset = (DstY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Destination = Configure->FrameBuffer + Offset;
|
||||
|
||||
if (Configure->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
|
||||
Source = (UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||
Source = (UINT8 *)BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||
} else {
|
||||
for (IndexX = 0; IndexX < Width; IndexX++) {
|
||||
Blt =
|
||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (
|
||||
(UINT8 *) BltBuffer +
|
||||
(SrcY * Delta) +
|
||||
((SourceX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))
|
||||
);
|
||||
Uint32 = *(UINT32*) Blt;
|
||||
*(UINT32*) (Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)) =
|
||||
(UINT32) (
|
||||
(((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &
|
||||
Configure->PixelMasks.RedMask) |
|
||||
(((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &
|
||||
Configure->PixelMasks.GreenMask) |
|
||||
(((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &
|
||||
Configure->PixelMasks.BlueMask)
|
||||
);
|
||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)(
|
||||
(UINT8 *)BltBuffer +
|
||||
(SrcY * Delta) +
|
||||
((SourceX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))
|
||||
);
|
||||
Uint32 = *(UINT32 *)Blt;
|
||||
*(UINT32 *)(Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)) =
|
||||
(UINT32)(
|
||||
(((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &
|
||||
Configure->PixelMasks.RedMask) |
|
||||
(((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &
|
||||
Configure->PixelMasks.GreenMask) |
|
||||
(((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &
|
||||
Configure->PixelMasks.BlueMask)
|
||||
);
|
||||
}
|
||||
|
||||
Source = Configure->LineBuffer;
|
||||
}
|
||||
|
||||
@ -550,20 +570,20 @@ FrameBufferBltLibBufferToVideo (
|
||||
**/
|
||||
RETURN_STATUS
|
||||
FrameBufferBltLibVideoToVideo (
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height
|
||||
)
|
||||
{
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
INTN LineStride;
|
||||
UINT8 *Source;
|
||||
UINT8 *Destination;
|
||||
UINTN Offset;
|
||||
UINTN WidthInBytes;
|
||||
INTN LineStride;
|
||||
|
||||
//
|
||||
// Video to Video: Source is Video, destination is Video
|
||||
@ -584,7 +604,7 @@ FrameBufferBltLibVideoToVideo (
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -594,8 +614,8 @@ FrameBufferBltLibVideoToVideo (
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Source = Configure->FrameBuffer + Offset;
|
||||
|
||||
Offset = (DestinationY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Offset = (DestinationY * Configure->PixelsPerScanLine) + DestinationX;
|
||||
Offset = Configure->BytesPerPixel * Offset;
|
||||
Destination = Configure->FrameBuffer + Offset;
|
||||
|
||||
LineStride = Configure->BytesPerPixel * Configure->PixelsPerScanLine;
|
||||
@ -603,15 +623,15 @@ FrameBufferBltLibVideoToVideo (
|
||||
//
|
||||
// Copy from last line to avoid source is corrupted by copying
|
||||
//
|
||||
Source += Height * LineStride;
|
||||
Source += Height * LineStride;
|
||||
Destination += Height * LineStride;
|
||||
LineStride = -LineStride;
|
||||
LineStride = -LineStride;
|
||||
}
|
||||
|
||||
while (Height-- > 0) {
|
||||
CopyMem (Destination, Source, WidthInBytes);
|
||||
|
||||
Source += LineStride;
|
||||
Source += LineStride;
|
||||
Destination += LineStride;
|
||||
}
|
||||
|
||||
@ -648,16 +668,16 @@ FrameBufferBltLibVideoToVideo (
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
FrameBufferBlt (
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
IN FRAME_BUFFER_CONFIGURE *Configure,
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
)
|
||||
{
|
||||
if (Configure == NULL) {
|
||||
@ -665,54 +685,54 @@ FrameBufferBlt (
|
||||
}
|
||||
|
||||
switch (BltOperation) {
|
||||
case EfiBltVideoToBltBuffer:
|
||||
return FrameBufferBltLibVideoToBltBuffer (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height,
|
||||
Delta
|
||||
);
|
||||
case EfiBltVideoToBltBuffer:
|
||||
return FrameBufferBltLibVideoToBltBuffer (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height,
|
||||
Delta
|
||||
);
|
||||
|
||||
case EfiBltVideoToVideo:
|
||||
return FrameBufferBltLibVideoToVideo (
|
||||
Configure,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height
|
||||
);
|
||||
case EfiBltVideoToVideo:
|
||||
return FrameBufferBltLibVideoToVideo (
|
||||
Configure,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height
|
||||
);
|
||||
|
||||
case EfiBltVideoFill:
|
||||
return FrameBufferBltLibVideoFill (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height
|
||||
);
|
||||
case EfiBltVideoFill:
|
||||
return FrameBufferBltLibVideoFill (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height
|
||||
);
|
||||
|
||||
case EfiBltBufferToVideo:
|
||||
return FrameBufferBltLibBufferToVideo (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height,
|
||||
Delta
|
||||
);
|
||||
case EfiBltBufferToVideo:
|
||||
return FrameBufferBltLibBufferToVideo (
|
||||
Configure,
|
||||
BltBuffer,
|
||||
SourceX,
|
||||
SourceY,
|
||||
DestinationX,
|
||||
DestinationY,
|
||||
Width,
|
||||
Height,
|
||||
Delta
|
||||
);
|
||||
|
||||
default:
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
default:
|
||||
return RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user