/*++\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
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- EFI_STATUS Status;\r
TEXT_OUT_GOP_MODE *Mode;\r
\r
if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {\r
return EFI_NOT_STARTED;\r
}\r
\r
- Status = gBS->AllocatePool (\r
- EfiBootServicesData,\r
- sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),\r
- (VOID **) Info\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
+ *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
+\r
+ if (*Info == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
}\r
\r
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
// Free the old version\r
//\r
if (Private->GraphicsOutputBlt != NULL) {\r
- gBS->FreePool (Private->GraphicsOutputBlt);\r
+ FreePool (Private->GraphicsOutputBlt);\r
}\r
\r
//\r
return Status;\r
}\r
if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {\r
- gBS->FreePool (Info);\r
+ FreePool (Info);\r
break;\r
}\r
- gBS->FreePool (Info);\r
+ FreePool (Info);\r
}\r
\r
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\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
// Free the old version\r
//\r
- gBS->FreePool (Private->UgaBlt);\r
+ FreePool (Private->UgaBlt);\r
\r
//\r
// Allocate the virtual Blt buffer\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
Private->TextOutMode.Mode = (INT32) ModeNumber;\r
Private->DevNullColumns = Column;\r
Private->DevNullRows = Row;\r
-\r
- gBS->FreePool (Private->DevNullScreen);\r
+ \r
+ if (Private->DevNullScreen != NULL) {\r
+ FreePool (Private->DevNullScreen);\r
+ }\r
\r
Size = (Row * (Column + 1)) * sizeof (CHAR16);\r
Private->DevNullScreen = AllocateZeroPool (Size);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- gBS->FreePool (Private->DevNullAttributes);\r
+ if (Private->DevNullAttributes != NULL) {\r
+ FreePool (Private->DevNullAttributes);\r
+ }\r
\r
Size = Row * Column * sizeof (INT32);\r
Private->DevNullAttributes = AllocateZeroPool (Size);\r
}\r
}\r
\r
- gBS->FreePool (Buffer);\r
+ FreePool (Buffer);\r
\r
return ReturnStatus;\r
}\r