/*++\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
)\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
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
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
)\r
{\r
UINTN SrcY;\r
+ BOOLEAN Forward;\r
UINTN Index;\r
EFI_UGA_PIXEL *BltPtr;\r
EFI_UGA_PIXEL *ScreenPtr;\r
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
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