]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / FrameBufferBltLib / FrameBufferBltLib.c
index 3731c3f34a171e1676a96894e73b79e3b11d4de1..432577bcfd6c2b586e8e6d25fa2b545a76395d65 100644 (file)
 #include <Library/FrameBufferBltLib.h>\r
 \r
 struct FRAME_BUFFER_CONFIGURE {\r
-  UINT32                          PixelsPerScanLine;\r
-  UINT32                          BytesPerPixel;\r
-  UINT32                          Width;\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
+  UINT32                       PixelsPerScanLine;\r
+  UINT32                       BytesPerPixel;\r
+  UINT32                       Width;\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
+CONST EFI_PIXEL_BITMASK  mRgbPixelMasks = {\r
   0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000\r
 };\r
 \r
-CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {\r
+CONST EFI_PIXEL_BITMASK  mBgrPixelMasks = {\r
   0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000\r
 };\r
 \r
@@ -45,10 +45,10 @@ CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {
 **/\r
 VOID\r
 FrameBufferBltLibConfigurePixelFormat (\r
-  IN CONST EFI_PIXEL_BITMASK    *BitMask,\r
-  OUT UINT32                    *BytesPerPixel,\r
-  OUT INT8                      *PixelShl,\r
-  OUT INT8                      *PixelShr\r
+  IN CONST EFI_PIXEL_BITMASK  *BitMask,\r
+  OUT UINT32                  *BytesPerPixel,\r
+  OUT INT8                    *PixelShl,\r
+  OUT INT8                    *PixelShr\r
   )\r
 {\r
   UINT8   Index;\r
@@ -58,26 +58,34 @@ FrameBufferBltLibConfigurePixelFormat (
   ASSERT (BytesPerPixel != NULL);\r
 \r
   MergedMasks = 0;\r
-  Masks = (UINT32*) BitMask;\r
+  Masks       = (UINT32 *)BitMask;\r
   for (Index = 0; Index < 3; Index++) {\r
     ASSERT ((MergedMasks & Masks[Index]) == 0);\r
 \r
-    PixelShl[Index] = (INT8) HighBitSet32 (Masks[Index]) - 23 + (Index * 8);\r
+    PixelShl[Index] = (INT8)HighBitSet32 (Masks[Index]) - 23 + (Index * 8);\r
     if (PixelShl[Index] < 0) {\r
       PixelShr[Index] = -PixelShl[Index];\r
       PixelShl[Index] = 0;\r
     } else {\r
       PixelShr[Index] = 0;\r
     }\r
-    DEBUG ((DEBUG_INFO, "%d: shl:%d shr:%d mask:%x\n", Index,\r
-            PixelShl[Index], PixelShr[Index], Masks[Index]));\r
 \r
-    MergedMasks = (UINT32) (MergedMasks | Masks[Index]);\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      "%d: shl:%d shr:%d mask:%x\n",\r
+      Index,\r
+      PixelShl[Index],\r
+      PixelShr[Index],\r
+      Masks[Index]\r
+      ));\r
+\r
+    MergedMasks = (UINT32)(MergedMasks | Masks[Index]);\r
   }\r
-  MergedMasks = (UINT32) (MergedMasks | Masks[3]);\r
+\r
+  MergedMasks = (UINT32)(MergedMasks | Masks[3]);\r
 \r
   ASSERT (MergedMasks != 0);\r
-  *BytesPerPixel = (UINT32) ((HighBitSet32 (MergedMasks) + 7) / 8);\r
+  *BytesPerPixel = (UINT32)((HighBitSet32 (MergedMasks) + 7) / 8);\r
   DEBUG ((DEBUG_INFO, "Bytes per pixel: %d\n", *BytesPerPixel));\r
 }\r
 \r
@@ -107,35 +115,35 @@ FrameBufferBltConfigure (
   IN OUT UINTN                                 *ConfigureSize\r
   )\r
 {\r
-  CONST EFI_PIXEL_BITMASK                      *BitMask;\r
-  UINT32                                       BytesPerPixel;\r
-  INT8                                         PixelShl[4];\r
-  INT8                                         PixelShr[4];\r
+  CONST EFI_PIXEL_BITMASK  *BitMask;\r
+  UINT32                   BytesPerPixel;\r
+  INT8                     PixelShl[4];\r
+  INT8                     PixelShr[4];\r
 \r
   if (ConfigureSize == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   switch (FrameBufferInfo->PixelFormat) {\r
-  case PixelRedGreenBlueReserved8BitPerColor:\r
-    BitMask = &mRgbPixelMasks;\r
-    break;\r
+    case PixelRedGreenBlueReserved8BitPerColor:\r
+      BitMask = &mRgbPixelMasks;\r
+      break;\r
 \r
-  case PixelBlueGreenRedReserved8BitPerColor:\r
-    BitMask = &mBgrPixelMasks;\r
-    break;\r
+    case PixelBlueGreenRedReserved8BitPerColor:\r
+      BitMask = &mBgrPixelMasks;\r
+      break;\r
 \r
-  case PixelBitMask:\r
-    BitMask = &FrameBufferInfo->PixelInformation;\r
-    break;\r
+    case PixelBitMask:\r
+      BitMask = &FrameBufferInfo->PixelInformation;\r
+      break;\r
 \r
-  case PixelBltOnly:\r
-    ASSERT (FrameBufferInfo->PixelFormat != PixelBltOnly);\r
-    return RETURN_UNSUPPORTED;\r
+    case PixelBltOnly:\r
+      ASSERT (FrameBufferInfo->PixelFormat != PixelBltOnly);\r
+      return RETURN_UNSUPPORTED;\r
 \r
-  default:\r
-    ASSERT (FALSE);\r
-    return RETURN_INVALID_PARAMETER;\r
+    default:\r
+      ASSERT (FALSE);\r
+      return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   if (FrameBufferInfo->PixelsPerScanLine < FrameBufferInfo->HorizontalResolution) {\r
@@ -145,9 +153,10 @@ FrameBufferBltConfigure (
   FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl, PixelShr);\r
 \r
   if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE)\r
-                     + FrameBufferInfo->HorizontalResolution * BytesPerPixel) {\r
+      + FrameBufferInfo->HorizontalResolution * BytesPerPixel)\r
+  {\r
     *ConfigureSize = sizeof (FRAME_BUFFER_CONFIGURE)\r
-                   + FrameBufferInfo->HorizontalResolution * BytesPerPixel;\r
+                     + FrameBufferInfo->HorizontalResolution * BytesPerPixel;\r
     return RETURN_BUFFER_TOO_SMALL;\r
   }\r
 \r
@@ -155,12 +164,12 @@ FrameBufferBltConfigure (
     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
+  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->FrameBuffer       = (UINT8 *)FrameBuffer;\r
   Configure->Width             = FrameBufferInfo->HorizontalResolution;\r
   Configure->Height            = FrameBufferInfo->VerticalResolution;\r
   Configure->PixelsPerScanLine = FrameBufferInfo->PixelsPerScanLine;\r
@@ -185,25 +194,25 @@ FrameBufferBltConfigure (
 **/\r
 EFI_STATUS\r
 FrameBufferBltLibVideoFill (\r
-  IN  FRAME_BUFFER_CONFIGURE        *Configure,\r
-  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Color,\r
-  IN  UINTN                         DestinationX,\r
-  IN  UINTN                         DestinationY,\r
-  IN  UINTN                         Width,\r
-  IN  UINTN                         Height\r
+  IN  FRAME_BUFFER_CONFIGURE         *Configure,\r
+  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *Color,\r
+  IN  UINTN                          DestinationX,\r
+  IN  UINTN                          DestinationY,\r
+  IN  UINTN                          Width,\r
+  IN  UINTN                          Height\r
   )\r
 {\r
-  UINTN                             IndexX;\r
-  UINTN                             IndexY;\r
-  UINT8                             *Destination;\r
-  UINT8                             Uint8;\r
-  UINT32                            Uint32;\r
-  UINT64                            WideFill;\r
-  BOOLEAN                           UseWideFill;\r
-  BOOLEAN                           LineBufferReady;\r
-  UINTN                             Offset;\r
-  UINTN                             WidthInBytes;\r
-  UINTN                             SizeInBytes;\r
+  UINTN    IndexX;\r
+  UINTN    IndexY;\r
+  UINT8    *Destination;\r
+  UINT8    Uint8;\r
+  UINT32   Uint32;\r
+  UINT64   WideFill;\r
+  BOOLEAN  UseWideFill;\r
+  BOOLEAN  LineBufferReady;\r
+  UINTN    Offset;\r
+  UINTN    WidthInBytes;\r
+  UINTN    SizeInBytes;\r
 \r
   //\r
   // BltBuffer to Video: Source is BltBuffer, destination is Video\r
@@ -218,25 +227,29 @@ FrameBufferBltLibVideoFill (
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Width == 0 || Height == 0) {\r
+  if ((Width == 0) || (Height == 0)) {\r
     DEBUG ((DEBUG_VERBOSE, "VideoFill: Width or Height is 0\n"));\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   WidthInBytes = Width * Configure->BytesPerPixel;\r
 \r
-  Uint32 = *(UINT32*) Color;\r
+  Uint32   = *(UINT32 *)Color;\r
   WideFill =\r
-    (UINT32) (\r
-    (((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &\r
-     Configure->PixelMasks.RedMask) |\r
-     (((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &\r
-      Configure->PixelMasks.GreenMask) |\r
-      (((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &\r
-       Configure->PixelMasks.BlueMask)\r
-      );\r
-  DEBUG ((DEBUG_VERBOSE, "VideoFill: color=0x%x, wide-fill=0x%x\n",\r
-          Uint32, WideFill));\r
+    (UINT32)(\r
+             (((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &\r
+              Configure->PixelMasks.RedMask) |\r
+             (((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &\r
+              Configure->PixelMasks.GreenMask) |\r
+             (((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &\r
+              Configure->PixelMasks.BlueMask)\r
+             );\r
+  DEBUG ((\r
+    DEBUG_VERBOSE,\r
+    "VideoFill: color=0x%x, wide-fill=0x%x\n",\r
+    Uint32,\r
+    WideFill\r
+    ));\r
 \r
   //\r
   // If the size of the pixel data evenly divides the sizeof\r
@@ -245,7 +258,7 @@ FrameBufferBltLibVideoFill (
   UseWideFill = TRUE;\r
   if ((sizeof (WideFill) % Configure->BytesPerPixel) == 0) {\r
     for (IndexX = Configure->BytesPerPixel; IndexX < sizeof (WideFill); IndexX++) {\r
-      ((UINT8*) &WideFill)[IndexX] = ((UINT8*) &WideFill)[IndexX % Configure->BytesPerPixel];\r
+      ((UINT8 *)&WideFill)[IndexX] = ((UINT8 *)&WideFill)[IndexX % Configure->BytesPerPixel];\r
     }\r
   } else {\r
     //\r
@@ -253,14 +266,16 @@ FrameBufferBltLibVideoFill (
     // a wide fill operation.\r
     //\r
     for (\r
-      IndexX = 1, Uint8 = ((UINT8*) &WideFill)[0];\r
-      IndexX < Configure->BytesPerPixel;\r
-      IndexX++) {\r
-      if (Uint8 != ((UINT8*) &WideFill)[IndexX]) {\r
+         IndexX = 1, Uint8 = ((UINT8 *)&WideFill)[0];\r
+         IndexX < Configure->BytesPerPixel;\r
+         IndexX++)\r
+    {\r
+      if (Uint8 != ((UINT8 *)&WideFill)[IndexX]) {\r
         UseWideFill = FALSE;\r
         break;\r
       }\r
     }\r
+\r
     if (UseWideFill) {\r
       SetMem (&WideFill, sizeof (WideFill), Uint8);\r
     }\r
@@ -268,26 +283,27 @@ FrameBufferBltLibVideoFill (
 \r
   if (UseWideFill && (DestinationX == 0) && (Width == Configure->PixelsPerScanLine)) {\r
     DEBUG ((DEBUG_VERBOSE, "VideoFill (wide, one-shot)\n"));\r
-    Offset = DestinationY * Configure->PixelsPerScanLine;\r
-    Offset = Configure->BytesPerPixel * Offset;\r
+    Offset      = DestinationY * Configure->PixelsPerScanLine;\r
+    Offset      = Configure->BytesPerPixel * Offset;\r
     Destination = Configure->FrameBuffer + Offset;\r
     SizeInBytes = WidthInBytes * Height;\r
     if (SizeInBytes >= 8) {\r
-      SetMem32 (Destination, SizeInBytes & ~3, (UINT32) WideFill);\r
+      SetMem32 (Destination, SizeInBytes & ~3, (UINT32)WideFill);\r
       Destination += SizeInBytes & ~3;\r
       SizeInBytes &= 3;\r
     }\r
+\r
     if (SizeInBytes > 0) {\r
-      SetMem (Destination, SizeInBytes, (UINT8) (UINTN) WideFill);\r
+      SetMem (Destination, SizeInBytes, (UINT8)(UINTN)WideFill);\r
     }\r
   } else {\r
     LineBufferReady = FALSE;\r
     for (IndexY = DestinationY; IndexY < (Height + DestinationY); IndexY++) {\r
-      Offset = (IndexY * Configure->PixelsPerScanLine) + DestinationX;\r
-      Offset = Configure->BytesPerPixel * Offset;\r
+      Offset      = (IndexY * Configure->PixelsPerScanLine) + DestinationX;\r
+      Offset      = Configure->BytesPerPixel * Offset;\r
       Destination = Configure->FrameBuffer + Offset;\r
 \r
-      if (UseWideFill && (((UINTN) Destination & 7) == 0)) {\r
+      if (UseWideFill && (((UINTN)Destination & 7) == 0)) {\r
         DEBUG ((DEBUG_VERBOSE, "VideoFill (wide)\n"));\r
         SizeInBytes = WidthInBytes;\r
         if (SizeInBytes >= 8) {\r
@@ -295,6 +311,7 @@ FrameBufferBltLibVideoFill (
           Destination += SizeInBytes & ~7;\r
           SizeInBytes &= 7;\r
         }\r
+\r
         if (SizeInBytes > 0) {\r
           CopyMem (Destination, &WideFill, SizeInBytes);\r
         }\r
@@ -307,11 +324,13 @@ FrameBufferBltLibVideoFill (
               (Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)),\r
               Configure->LineBuffer,\r
               MIN (IndexX, Width - IndexX) * Configure->BytesPerPixel\r
-            );\r
+              );\r
             IndexX += MIN (IndexX, Width - IndexX);\r
           }\r
+\r
           LineBufferReady = TRUE;\r
         }\r
+\r
         CopyMem (Destination, Configure->LineBuffer, WidthInBytes);\r
       }\r
     }\r
@@ -340,26 +359,26 @@ FrameBufferBltLibVideoFill (
 **/\r
 RETURN_STATUS\r
 FrameBufferBltLibVideoToBltBuffer (\r
-  IN     FRAME_BUFFER_CONFIGURE          *Configure,\r
-     OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL   *BltBuffer,\r
-  IN     UINTN                           SourceX,\r
-  IN     UINTN                           SourceY,\r
-  IN     UINTN                           DestinationX,\r
-  IN     UINTN                           DestinationY,\r
-  IN     UINTN                           Width,\r
-  IN     UINTN                           Height,\r
-  IN     UINTN                           Delta\r
+  IN     FRAME_BUFFER_CONFIGURE      *Configure,\r
+  OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltBuffer,\r
+  IN     UINTN                       SourceX,\r
+  IN     UINTN                       SourceY,\r
+  IN     UINTN                       DestinationX,\r
+  IN     UINTN                       DestinationY,\r
+  IN     UINTN                       Width,\r
+  IN     UINTN                       Height,\r
+  IN     UINTN                       Delta\r
   )\r
 {\r
-  UINTN                                  DstY;\r
-  UINTN                                  SrcY;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL          *Blt;\r
-  UINT8                                  *Source;\r
-  UINT8                                  *Destination;\r
-  UINTN                                  IndexX;\r
-  UINT32                                 Uint32;\r
-  UINTN                                  Offset;\r
-  UINTN                                  WidthInBytes;\r
+  UINTN                          DstY;\r
+  UINTN                          SrcY;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *Blt;\r
+  UINT8                          *Source;\r
+  UINT8                          *Destination;\r
+  UINTN                          IndexX;\r
+  UINT32                         Uint32;\r
+  UINTN                          Offset;\r
+  UINTN                          WidthInBytes;\r
 \r
   //\r
   // Video to BltBuffer: Source is Video, destination is BltBuffer\r
@@ -372,7 +391,7 @@ FrameBufferBltLibVideoToBltBuffer (
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Width == 0 || Height == 0) {\r
+  if ((Width == 0) || (Height == 0)) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
@@ -392,14 +411,14 @@ FrameBufferBltLibVideoToBltBuffer (
   //\r
   for (SrcY = SourceY, DstY = DestinationY;\r
        DstY < (Height + DestinationY);\r
-       SrcY++, DstY++) {\r
-\r
+       SrcY++, DstY++)\r
+  {\r
     Offset = (SrcY * Configure->PixelsPerScanLine) + SourceX;\r
     Offset = Configure->BytesPerPixel * Offset;\r
     Source = Configure->FrameBuffer + Offset;\r
 \r
     if (Configure->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {\r
-      Destination = (UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
+      Destination = (UINT8 *)BltBuffer + (DstY * Delta) + (DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
     } else {\r
       Destination = Configure->LineBuffer;\r
     }\r
@@ -409,18 +428,18 @@ FrameBufferBltLibVideoToBltBuffer (
     if (Configure->PixelFormat != PixelBlueGreenRedReserved8BitPerColor) {\r
       for (IndexX = 0; IndexX < Width; IndexX++) {\r
         Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)\r
-          ((UINT8 *) BltBuffer + (DstY * Delta) +\r
-          (DestinationX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
-        Uint32 = *(UINT32*) (Configure->LineBuffer + (IndexX * Configure->BytesPerPixel));\r
-        *(UINT32*) Blt =\r
-          (UINT32) (\r
-          (((Uint32 & Configure->PixelMasks.RedMask) >>\r
-            Configure->PixelShl[0]) << Configure->PixelShr[0]) |\r
-            (((Uint32 & Configure->PixelMasks.GreenMask) >>\r
-              Configure->PixelShl[1]) << Configure->PixelShr[1]) |\r
-              (((Uint32 & Configure->PixelMasks.BlueMask) >>\r
-                Configure->PixelShl[2]) << Configure->PixelShr[2])\r
-            );\r
+              ((UINT8 *)BltBuffer + (DstY * Delta) +\r
+               (DestinationX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
+        Uint32         = *(UINT32 *)(Configure->LineBuffer + (IndexX * Configure->BytesPerPixel));\r
+        *(UINT32 *)Blt =\r
+          (UINT32)(\r
+                   (((Uint32 & Configure->PixelMasks.RedMask) >>\r
+                     Configure->PixelShl[0]) << Configure->PixelShr[0]) |\r
+                   (((Uint32 & Configure->PixelMasks.GreenMask) >>\r
+                     Configure->PixelShl[1]) << Configure->PixelShr[1]) |\r
+                   (((Uint32 & Configure->PixelMasks.BlueMask) >>\r
+                     Configure->PixelShl[2]) << Configure->PixelShr[2])\r
+                   );\r
       }\r
     }\r
   }\r
@@ -448,26 +467,26 @@ FrameBufferBltLibVideoToBltBuffer (
 **/\r
 RETURN_STATUS\r
 FrameBufferBltLibBufferToVideo (\r
-  IN  FRAME_BUFFER_CONFIGURE                *Configure,\r
-  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *BltBuffer,\r
-  IN  UINTN                                 SourceX,\r
-  IN  UINTN                                 SourceY,\r
-  IN  UINTN                                 DestinationX,\r
-  IN  UINTN                                 DestinationY,\r
-  IN  UINTN                                 Width,\r
-  IN  UINTN                                 Height,\r
-  IN  UINTN                                 Delta\r
+  IN  FRAME_BUFFER_CONFIGURE         *Configure,\r
+  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltBuffer,\r
+  IN  UINTN                          SourceX,\r
+  IN  UINTN                          SourceY,\r
+  IN  UINTN                          DestinationX,\r
+  IN  UINTN                          DestinationY,\r
+  IN  UINTN                          Width,\r
+  IN  UINTN                          Height,\r
+  IN  UINTN                          Delta\r
   )\r
 {\r
-  UINTN                                    DstY;\r
-  UINTN                                    SrcY;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL            *Blt;\r
-  UINT8                                    *Source;\r
-  UINT8                                    *Destination;\r
-  UINTN                                    IndexX;\r
-  UINT32                                   Uint32;\r
-  UINTN                                    Offset;\r
-  UINTN                                    WidthInBytes;\r
+  UINTN                          DstY;\r
+  UINTN                          SrcY;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *Blt;\r
+  UINT8                          *Source;\r
+  UINT8                          *Destination;\r
+  UINTN                          IndexX;\r
+  UINT32                         Uint32;\r
+  UINTN                          Offset;\r
+  UINTN                          WidthInBytes;\r
 \r
   //\r
   // BltBuffer to Video: Source is BltBuffer, destination is Video\r
@@ -480,7 +499,7 @@ FrameBufferBltLibBufferToVideo (
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Width == 0 || Height == 0) {\r
+  if ((Width == 0) || (Height == 0)) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
@@ -497,33 +516,34 @@ FrameBufferBltLibBufferToVideo (
 \r
   for (SrcY = SourceY, DstY = DestinationY;\r
        SrcY < (Height + SourceY);\r
-       SrcY++, DstY++) {\r
-\r
-    Offset = (DstY * Configure->PixelsPerScanLine) + DestinationX;\r
-    Offset = Configure->BytesPerPixel * Offset;\r
+       SrcY++, DstY++)\r
+  {\r
+    Offset      = (DstY * Configure->PixelsPerScanLine) + DestinationX;\r
+    Offset      = Configure->BytesPerPixel * Offset;\r
     Destination = Configure->FrameBuffer + Offset;\r
 \r
     if (Configure->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {\r
-      Source = (UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
+      Source = (UINT8 *)BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
     } else {\r
       for (IndexX = 0; IndexX < Width; IndexX++) {\r
         Blt =\r
-          (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (\r
-              (UINT8 *) BltBuffer +\r
-              (SrcY * Delta) +\r
-              ((SourceX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))\r
-            );\r
-        Uint32 = *(UINT32*) Blt;\r
-        *(UINT32*) (Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)) =\r
-          (UINT32) (\r
-              (((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &\r
-               Configure->PixelMasks.RedMask) |\r
-              (((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &\r
-               Configure->PixelMasks.GreenMask) |\r
-              (((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &\r
-               Configure->PixelMasks.BlueMask)\r
-            );\r
+          (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)(\r
+                                            (UINT8 *)BltBuffer +\r
+                                            (SrcY * Delta) +\r
+                                            ((SourceX + IndexX) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))\r
+                                            );\r
+        Uint32                                                                   = *(UINT32 *)Blt;\r
+        *(UINT32 *)(Configure->LineBuffer + (IndexX * Configure->BytesPerPixel)) =\r
+          (UINT32)(\r
+                   (((Uint32 << Configure->PixelShl[0]) >> Configure->PixelShr[0]) &\r
+                    Configure->PixelMasks.RedMask) |\r
+                   (((Uint32 << Configure->PixelShl[1]) >> Configure->PixelShr[1]) &\r
+                    Configure->PixelMasks.GreenMask) |\r
+                   (((Uint32 << Configure->PixelShl[2]) >> Configure->PixelShr[2]) &\r
+                    Configure->PixelMasks.BlueMask)\r
+                   );\r
       }\r
+\r
       Source = Configure->LineBuffer;\r
     }\r
 \r
@@ -550,20 +570,20 @@ FrameBufferBltLibBufferToVideo (
 **/\r
 RETURN_STATUS\r
 FrameBufferBltLibVideoToVideo (\r
-  IN  FRAME_BUFFER_CONFIGURE                *Configure,\r
-  IN  UINTN                                 SourceX,\r
-  IN  UINTN                                 SourceY,\r
-  IN  UINTN                                 DestinationX,\r
-  IN  UINTN                                 DestinationY,\r
-  IN  UINTN                                 Width,\r
-  IN  UINTN                                 Height\r
+  IN  FRAME_BUFFER_CONFIGURE  *Configure,\r
+  IN  UINTN                   SourceX,\r
+  IN  UINTN                   SourceY,\r
+  IN  UINTN                   DestinationX,\r
+  IN  UINTN                   DestinationY,\r
+  IN  UINTN                   Width,\r
+  IN  UINTN                   Height\r
   )\r
 {\r
-  UINT8                                     *Source;\r
-  UINT8                                     *Destination;\r
-  UINTN                                     Offset;\r
-  UINTN                                     WidthInBytes;\r
-  INTN                                      LineStride;\r
+  UINT8  *Source;\r
+  UINT8  *Destination;\r
+  UINTN  Offset;\r
+  UINTN  WidthInBytes;\r
+  INTN   LineStride;\r
 \r
   //\r
   // Video to Video: Source is Video, destination is Video\r
@@ -584,7 +604,7 @@ FrameBufferBltLibVideoToVideo (
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Width == 0 || Height == 0) {\r
+  if ((Width == 0) || (Height == 0)) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
@@ -594,8 +614,8 @@ FrameBufferBltLibVideoToVideo (
   Offset = Configure->BytesPerPixel * Offset;\r
   Source = Configure->FrameBuffer + Offset;\r
 \r
-  Offset = (DestinationY * Configure->PixelsPerScanLine) + DestinationX;\r
-  Offset = Configure->BytesPerPixel * Offset;\r
+  Offset      = (DestinationY * Configure->PixelsPerScanLine) + DestinationX;\r
+  Offset      = Configure->BytesPerPixel * Offset;\r
   Destination = Configure->FrameBuffer + Offset;\r
 \r
   LineStride = Configure->BytesPerPixel * Configure->PixelsPerScanLine;\r
@@ -603,15 +623,15 @@ FrameBufferBltLibVideoToVideo (
     //\r
     // Copy from last line to avoid source is corrupted by copying\r
     //\r
-    Source += Height * LineStride;\r
+    Source      += Height * LineStride;\r
     Destination += Height * LineStride;\r
-    LineStride = -LineStride;\r
+    LineStride   = -LineStride;\r
   }\r
 \r
   while (Height-- > 0) {\r
     CopyMem (Destination, Source, WidthInBytes);\r
 \r
-    Source += LineStride;\r
+    Source      += LineStride;\r
     Destination += LineStride;\r
   }\r
 \r
@@ -648,16 +668,16 @@ FrameBufferBltLibVideoToVideo (
 RETURN_STATUS\r
 EFIAPI\r
 FrameBufferBlt (\r
-  IN     FRAME_BUFFER_CONFIGURE                *Configure,\r
-  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *BltBuffer  OPTIONAL,\r
-  IN     EFI_GRAPHICS_OUTPUT_BLT_OPERATION     BltOperation,\r
-  IN     UINTN                                 SourceX,\r
-  IN     UINTN                                 SourceY,\r
-  IN     UINTN                                 DestinationX,\r
-  IN     UINTN                                 DestinationY,\r
-  IN     UINTN                                 Width,\r
-  IN     UINTN                                 Height,\r
-  IN     UINTN                                 Delta\r
+  IN     FRAME_BUFFER_CONFIGURE             *Configure,\r
+  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL      *BltBuffer  OPTIONAL,\r
+  IN     EFI_GRAPHICS_OUTPUT_BLT_OPERATION  BltOperation,\r
+  IN     UINTN                              SourceX,\r
+  IN     UINTN                              SourceY,\r
+  IN     UINTN                              DestinationX,\r
+  IN     UINTN                              DestinationY,\r
+  IN     UINTN                              Width,\r
+  IN     UINTN                              Height,\r
+  IN     UINTN                              Delta\r
   )\r
 {\r
   if (Configure == NULL) {\r
@@ -665,54 +685,54 @@ FrameBufferBlt (
   }\r
 \r
   switch (BltOperation) {\r
-  case EfiBltVideoToBltBuffer:\r
-    return FrameBufferBltLibVideoToBltBuffer (\r
-             Configure,\r
-             BltBuffer,\r
-             SourceX,\r
-             SourceY,\r
-             DestinationX,\r
-             DestinationY,\r
-             Width,\r
-             Height,\r
-             Delta\r
-             );\r
-\r
-  case EfiBltVideoToVideo:\r
-    return FrameBufferBltLibVideoToVideo (\r
-             Configure,\r
-             SourceX,\r
-             SourceY,\r
-             DestinationX,\r
-             DestinationY,\r
-             Width,\r
-             Height\r
-             );\r
-\r
-  case EfiBltVideoFill:\r
-    return FrameBufferBltLibVideoFill (\r
-             Configure,\r
-             BltBuffer,\r
-             DestinationX,\r
-             DestinationY,\r
-             Width,\r
-             Height\r
-             );\r
-\r
-  case EfiBltBufferToVideo:\r
-    return FrameBufferBltLibBufferToVideo (\r
-             Configure,\r
-             BltBuffer,\r
-             SourceX,\r
-             SourceY,\r
-             DestinationX,\r
-             DestinationY,\r
-             Width,\r
-             Height,\r
-             Delta\r
-             );\r
-\r
-  default:\r
-    return RETURN_INVALID_PARAMETER;\r
+    case EfiBltVideoToBltBuffer:\r
+      return FrameBufferBltLibVideoToBltBuffer (\r
+               Configure,\r
+               BltBuffer,\r
+               SourceX,\r
+               SourceY,\r
+               DestinationX,\r
+               DestinationY,\r
+               Width,\r
+               Height,\r
+               Delta\r
+               );\r
+\r
+    case EfiBltVideoToVideo:\r
+      return FrameBufferBltLibVideoToVideo (\r
+               Configure,\r
+               SourceX,\r
+               SourceY,\r
+               DestinationX,\r
+               DestinationY,\r
+               Width,\r
+               Height\r
+               );\r
+\r
+    case EfiBltVideoFill:\r
+      return FrameBufferBltLibVideoFill (\r
+               Configure,\r
+               BltBuffer,\r
+               DestinationX,\r
+               DestinationY,\r
+               Width,\r
+               Height\r
+               );\r
+\r
+    case EfiBltBufferToVideo:\r
+      return FrameBufferBltLibBufferToVideo (\r
+               Configure,\r
+               BltBuffer,\r
+               SourceX,\r
+               SourceY,\r
+               DestinationX,\r
+               DestinationY,\r
+               Width,\r
+               Height,\r
+               Delta\r
+               );\r
+\r
+    default:\r
+      return RETURN_INVALID_PARAMETER;\r
   }\r
 }\r