]> 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 4bc15e6681688a040d823b6429f639fc6b35c37f..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
@@ -116,6 +116,13 @@ ConSpliterConsoleControlSetMode (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  //\r
+  // Judge current mode with wanted mode at first.\r
+  // \r
+  if (Private->ConsoleOutputMode == Mode) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   Supported   = FALSE;\r
   TextAndGop  = &Private->TextOutList[0];\r
   for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) {\r
@@ -355,6 +362,7 @@ Routine Description:
   return ReturnStatus;\r
 }\r
 \r
+STATIC\r
 EFI_STATUS\r
 DevNullGraphicsOutputBlt (\r
   IN  TEXT_OUT_SPLITTER_PRIVATE_DATA                *Private,\r
@@ -370,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
@@ -426,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
@@ -443,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
@@ -784,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
@@ -840,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
@@ -857,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