Skip to content

Commit

Permalink
Corrected some build errors related to MVSC instrisic functions (_all…
Browse files Browse the repository at this point in the history
…mul was being generated because of index variable calculations into array types)
  • Loading branch information
apop2 committed Apr 11, 2016
1 parent 811f72e commit bf594d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion GopRotate/GopRotate.inf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
[Guids]

[Pcd]
gGopRotatePkgGuid.DefaultGopRotation
gGopRotatePkgGuid.DefaultGopRotation

[Protocols]
gEfiGraphicsOutputProtocolGuid ## CONSUMES
Expand Down
22 changes: 11 additions & 11 deletions GopRotate/GopRotateBlt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GopRotateBlt.c
Copyright (c) 2015, Aaron Pop
Copyright (c) 2016, Aaron Pop
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -141,7 +141,6 @@ EFI_STATUS EFIAPI GopRotateSetRotation(GRAPHICS_OUTPUT_PROTOCOL_ROTATE_PROTOCOL

// Call the original Blt Function to fill the entire buffer
Private->Blt(Private->Gop, &BlackPixel, EfiBltVideoFill, 0, 0, 0, 0, Private->Gop->Mode->Info->HorizontalResolution, Private->Gop->Mode->Info->VerticalResolution, 0);
DEBUG((EFI_D_ERROR, "Continue\n"));
if(!EFI_ERROR(Status))
{
Status = Private->Gop->Blt(Private->Gop, Blt, EfiBltBufferToVideo, 0, 0, 0, 0, Private->Gop->Mode->Info->HorizontalResolution, Private->Gop->Mode->Info->VerticalResolution, 0);
Expand Down Expand Up @@ -258,7 +257,7 @@ EFI_STATUS PerformTranslations

TranslatedIndex = MultU64x32( DivU64x32(OriginalDelta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), OriginalSourceY+j) + (OriginalSourceX + OriginalWidth - i - 1);

gBS->CopyMem(&(MyBuffer[Index]), &((*BltBuffer)[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem(&(MyBuffer[(UINTN)Index]), &((*BltBuffer)[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}
}
Expand Down Expand Up @@ -345,7 +344,7 @@ EFI_STATUS PerformTranslations
{
Index = MultU64x32(DivU64x32(OriginalDelta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), (OriginalDestinationY + j)) + OriginalDestinationX + i;
TranslatedIndex = MultU64x32(*Width, (*Height - i - 1)) + j;
gBS->CopyMem(&((*BltBuffer)[Index]), &(MyBuffer[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem(&((*BltBuffer)[(UINTN)Index]), &(MyBuffer[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}
}
Expand All @@ -356,6 +355,7 @@ EFI_STATUS PerformTranslations
}
break;
}

case Rotate180:
{
if(*Delta == 0)
Expand All @@ -382,7 +382,7 @@ EFI_STATUS PerformTranslations
{
Index = MultU64x32(*Width, (*Height - j - 1)) + (*Width - i - 1);
TranslatedIndex = (UINTN)MultU64x32( DivU64x32(*Delta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), j) + i;
gBS->CopyMem( &(MyBuffer[Index]), &((*BltBuffer)[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem( &(MyBuffer[(UINTN)Index]), &((*BltBuffer)[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}
*BltBuffer = MyBuffer;
Expand Down Expand Up @@ -428,7 +428,7 @@ EFI_STATUS PerformTranslations
*SourceX = This->Mode->Info->HorizontalResolution - *Width - *SourceX;
*SourceY = This->Mode->Info->VerticalResolution - *Height - *SourceY;

Status = Private->Blt(This, MyBuffer, BltOperation, *SourceX, *SourceY, 0, 0, *Width, *Height, *Width*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
Status = Private->Blt(This, MyBuffer, BltOperation, *SourceX, *SourceY, 0, 0, *Width, *Height, (UINTN)MultU64x32(*Width, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)));
*SourceX = This->Mode->Info->HorizontalResolution - *Width - *SourceX;
*SourceY = This->Mode->Info->VerticalResolution - *Height - *SourceY;

Expand All @@ -438,7 +438,7 @@ EFI_STATUS PerformTranslations
{
Index = (UINTN)MultU64x32(DivU64x32(*Delta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), (*DestinationY + j)) + *DestinationX + i;
TranslatedIndex = MultU64x32(*Width, (*Height - j - 1)) + *Width - i - 1;
gBS->CopyMem( &((*BltBuffer)[Index]), &(MyBuffer[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem( &((*BltBuffer)[(UINTN)Index]), &(MyBuffer[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}

Expand Down Expand Up @@ -466,7 +466,7 @@ EFI_STATUS PerformTranslations
UINTN OriginalDelta = *Delta;
if(*Delta == 0)
{
*Delta = sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * *Width;
*Delta = (UINTN)MultU64x32(*Width, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
OriginalDelta = *Delta;
}
if(This->Mode->Info->VerticalResolution < (*DestinationX + *Width))
Expand Down Expand Up @@ -497,7 +497,7 @@ EFI_STATUS PerformTranslations
{
TranslatedIndex = (UINTN)MultU64x32( DivU64x32(OriginalDelta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), (OriginalSourceY + OriginalHeight - j - 1)) + OriginalSourceX + i;
Index = (UINTN)MultU64x32(*Height, i) + j;
gBS->CopyMem( &(MyBuffer[Index]), &((*BltBuffer)[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem( &(MyBuffer[(UINTN)Index]), &((*BltBuffer)[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}
}
Expand Down Expand Up @@ -583,7 +583,7 @@ EFI_STATUS PerformTranslations
*Width = OriginalHeight - ClippedX;
*Height = OriginalWidth;

*Delta = OriginalHeight * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
*Delta = (UINTN)MultU64x32(OriginalHeight, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));

Status = Private->Blt(This, MyBuffer, BltOperation, *SourceX, *SourceY, 0, 0, *Width, *Height, *Delta);

Expand All @@ -595,7 +595,7 @@ EFI_STATUS PerformTranslations

Index = (UINTN)MultU64x32( DivU64x32(OriginalDelta, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)), (OriginalDestinationY + j)) + i + OriginalDestinationX;

gBS->CopyMem( &((*BltBuffer)[Index]), &( MyBuffer[TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
gBS->CopyMem( &((*BltBuffer)[(UINTN)Index]), &( MyBuffer[(UINTN)TranslatedIndex]), sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions Include/Protocol/GopRotate.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GopRotate.h
Copyright (c) 2015, Aaron Pop
Copyright (c) 2016, Aaron Pop
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,7 +35,8 @@ typedef enum
Rotate0 = 0,
Rotate90 = 1,
Rotate180 = 2,
Rotate270 = 3
Rotate270 = 3,
RotateMax = 4
} ROTATE_SCREEN;

typedef struct _GRAPHICS_OUTPUT_PROTOCOL_ROTATE_PROTOCOL GRAPHICS_OUTPUT_PROTOCOL_ROTATE_PROTOCOL;
Expand Down

0 comments on commit bf594d7

Please sign in to comment.