/** @file\r
FrameBufferBltLib - Library to perform blt operations on a frame buffer.\r
\r
- Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Library/FrameBufferBltLib.h>\r
\r
struct FRAME_BUFFER_CONFIGURE {\r
- UINTN ColorDepth;\r
- UINTN WidthInBytes;\r
- UINTN BytesPerPixel;\r
- UINTN WidthInPixels;\r
- UINTN Height;\r
- UINT8 LineBuffer[SIZE_4KB * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)];\r
+ UINT32 WidthInBytes;\r
+ UINT32 BytesPerPixel;\r
+ UINT32 WidthInPixels;\r
+ UINT32 Height;\r
UINT8 *FrameBuffer;\r
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r
EFI_PIXEL_BITMASK PixelMasks;\r
INT8 PixelShl[4]; // R-G-B-Rsvd\r
INT8 PixelShr[4]; // R-G-B-Rsvd\r
+ UINT8 LineBuffer[0];\r
};\r
\r
CONST EFI_PIXEL_BITMASK mRgbPixelMasks = {\r
VOID\r
FrameBufferBltLibConfigurePixelFormat (\r
IN CONST EFI_PIXEL_BITMASK *BitMask,\r
- OUT UINTN *BytesPerPixel,\r
+ OUT UINT32 *BytesPerPixel,\r
OUT INT8 *PixelShl,\r
OUT INT8 *PixelShr\r
)\r
MergedMasks = (UINT32) (MergedMasks | Masks[3]);\r
\r
ASSERT (MergedMasks != 0);\r
- *BytesPerPixel = (UINTN) ((HighBitSet32 (MergedMasks) + 7) / 8);\r
+ *BytesPerPixel = (UINT32) ((HighBitSet32 (MergedMasks) + 7) / 8);\r
DEBUG ((DEBUG_INFO, "Bytes per pixel: %d\n", *BytesPerPixel));\r
}\r
\r
)\r
{\r
CONST EFI_PIXEL_BITMASK *BitMask;\r
- UINTN BytesPerPixel;\r
+ UINT32 BytesPerPixel;\r
INT8 PixelShl[4];\r
INT8 PixelShr[4];\r
\r
return RETURN_INVALID_PARAMETER;\r
}\r
\r
- if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE)) {\r
- *ConfigureSize = sizeof (FRAME_BUFFER_CONFIGURE);\r
- return RETURN_BUFFER_TOO_SMALL;\r
- }\r
-\r
- if (Configure == NULL) {\r
- return RETURN_INVALID_PARAMETER;\r
- }\r
-\r
switch (FrameBufferInfo->PixelFormat) {\r
case PixelRedGreenBlueReserved8BitPerColor:\r
BitMask = &mRgbPixelMasks;\r
\r
FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl, PixelShr);\r
\r
+ if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE)\r
+ + FrameBufferInfo->HorizontalResolution * BytesPerPixel) {\r
+ *ConfigureSize = sizeof (FRAME_BUFFER_CONFIGURE)\r
+ + FrameBufferInfo->HorizontalResolution * BytesPerPixel;\r
+ return RETURN_BUFFER_TOO_SMALL;\r
+ }\r
+\r
+ if (Configure == NULL) {\r
+ return RETURN_INVALID_PARAMETER;\r
+ }\r
+\r
CopyMem (&Configure->PixelMasks, BitMask, sizeof (*BitMask));\r
CopyMem (Configure->PixelShl, PixelShl, sizeof (PixelShl));\r
CopyMem (Configure->PixelShr, PixelShr, sizeof (PixelShr));\r
Configure->BytesPerPixel = BytesPerPixel;\r
Configure->PixelFormat = FrameBufferInfo->PixelFormat;\r
Configure->FrameBuffer = (UINT8*) FrameBuffer;\r
- Configure->WidthInPixels = (UINTN) FrameBufferInfo->HorizontalResolution;\r
- Configure->Height = (UINTN) FrameBufferInfo->VerticalResolution;\r
+ Configure->WidthInPixels = FrameBufferInfo->HorizontalResolution;\r
+ Configure->Height = FrameBufferInfo->VerticalResolution;\r
Configure->WidthInBytes = Configure->WidthInPixels * Configure->BytesPerPixel;\r
\r
- ASSERT (Configure->WidthInBytes < sizeof (Configure->LineBuffer));\r
-\r
return RETURN_SUCCESS;\r
}\r
\r