]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
1. Fix an issue about the calculation of GlyphBufferSize
[mirror_edk2.git] / EdkModulePkg / Universal / Console / ConSplitter / Dxe / ConSplitterGraphics.c
index 946835ed2971ac1d3309d82460ea8fb248f2725e..9726889ec843bd60ac0b514466513751bafcd94d 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -378,6 +378,7 @@ DevNullGraphicsOutputBlt (
   )\r
 {\r
   UINTN                         SrcY;\r
+  BOOLEAN                       Forward; \r
   UINTN                         Index;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPtr;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ScreenPtr;\r
@@ -434,9 +435,23 @@ DevNullGraphicsOutputBlt (
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
-    ScreenPtr = &Private->GraphicsOutputBlt[DestinationY * HorizontalResolution + DestinationX];\r
-    SrcY      = SourceY;\r
-    while (Height) {\r
+    if ((BltOperation == EfiBltVideoToVideo) && (DestinationY > SourceY)) {\r
+      //\r
+      // Copy backwards, only care the Video to Video Blt\r
+      //\r
+      ScreenPtr = &Private->GraphicsOutputBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX];\r
+      SrcY      = SourceY + Height - 1;\r
+      Forward   = FALSE;\r
+    } else {\r
+      //\r
+      // Copy forwards, for other cases\r
+      //\r
+      ScreenPtr = &Private->GraphicsOutputBlt[DestinationY * HorizontalResolution + DestinationX];\r
+      SrcY      = SourceY;\r
+      Forward   = TRUE;\r
+    }\r
+\r
+    while (Height != 0) {\r
       if (BltOperation == EfiBltVideoFill) {\r
         for (Index = 0; Index < Width; Index++) {\r
           ScreenPtr[Index] = *BltBuffer;\r
@@ -451,8 +466,13 @@ DevNullGraphicsOutputBlt (
         CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
       }\r
 \r
-      ScreenPtr += HorizontalResolution;\r
-      SrcY++;\r
+      if (Forward) {\r
+        ScreenPtr += HorizontalResolution;\r
+        SrcY ++;\r
+      } else {\r
+        ScreenPtr -= HorizontalResolution;\r
+        SrcY --;\r
+      }\r
       Height--;\r
     }\r
   }\r
@@ -792,6 +812,7 @@ DevNullUgaBlt (
   )\r
 {\r
   UINTN         SrcY;\r
+  BOOLEAN       Forward;\r
   UINTN         Index;\r
   EFI_UGA_PIXEL *BltPtr;\r
   EFI_UGA_PIXEL *ScreenPtr;\r
@@ -848,9 +869,23 @@ DevNullUgaBlt (
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
-    ScreenPtr = &Private->UgaBlt[DestinationY * HorizontalResolution + DestinationX];\r
-    SrcY      = SourceY;\r
-    while (Height) {\r
+    if ((BltOperation == EfiUgaVideoToVideo) && (DestinationY > SourceY)) {\r
+      //\r
+      // Copy backwards, only care the Video to Video Blt\r
+      //\r
+      ScreenPtr = &Private->UgaBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX];\r
+      SrcY      = SourceY + Height - 1;\r
+      Forward   = FALSE;\r
+    } else {\r
+      //\r
+      // Copy forwards, for other cases\r
+      //\r
+      ScreenPtr = &Private->UgaBlt[DestinationY * HorizontalResolution + DestinationX];\r
+      SrcY      = SourceY;\r
+      Forward   = TRUE;\r
+    }\r
+\r
+    while (Height != 0) {\r
       if (BltOperation == EfiUgaVideoFill) {\r
         for (Index = 0; Index < Width; Index++) {\r
           ScreenPtr[Index] = *BltBuffer;\r
@@ -865,8 +900,13 @@ DevNullUgaBlt (
         CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_UGA_PIXEL));\r
       }\r
 \r
-      ScreenPtr += HorizontalResolution;\r
-      SrcY++;\r
+      if (Forward) {\r
+        ScreenPtr += HorizontalResolution;\r
+        SrcY ++;\r
+      } else {\r
+        ScreenPtr -= HorizontalResolution;\r
+        SrcY --;\r
+      }\r
       Height--;\r
     }\r
   }\r