Skip to content

Commit

Permalink
OpenCanopy: Fix black splash with non-black bg
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed May 10, 2020
1 parent 8b5099b commit 76e889f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Include/Library/OcConsoleLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ typedef enum {
/**
Special commands sent to Builtin text renderer through TestString.
**/
#define OC_CONSOLE_CLEAR_AND_CLIP L"ClearAndClip"
#define OC_CONSOLE_CLEAR_WHOLE_AND_CLIP L"ClearWholeAndClip"
#define OC_CONSOLE_MARK_CONTROLLED L"MarkControlled"
#define OC_CONSOLE_MARK_UNCONTROLLED L"MarkUncontrolled"

/**
Configure console control protocol with given options.
Expand Down
18 changes: 13 additions & 5 deletions Library/OcBootManagementLib/OcBootManagementLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ OcShowSimpleBootMenu (
//
// Extension for OpenCore direct text render for faster redraw with custom background.
//
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_AND_CLIP);
gST->ConOut->ClearScreen (gST->ConOut);
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED);

while (TRUE) {
gST->ConOut->ClearScreen (gST->ConOut);
Expand Down Expand Up @@ -355,8 +356,8 @@ OcShowSimplePasswordRequest (

OcConsoleControlSetMode (EfiConsoleControlScreenText);
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_AND_CLIP);
gST->ConOut->ClearScreen (gST->ConOut);
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED);

for (Index = 0; Index < 3; ++Index) {
PwIndex = 0;
Expand Down Expand Up @@ -648,10 +649,17 @@ OcRunBootPicker (
}

//
// Clear screen from picker contents before loading the entry.
// Do screen clearing for builtin menu here, so that it is possible to see the action.
// TODO: Probably remove that completely.
//
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_WHOLE_AND_CLIP);
gST->ConOut->ClearScreen (gST->ConOut);
if (Context->ShowMenu == OcShowSimpleBootMenu) {
//
// Clear screen from picker contents before loading the entry.
//
gST->ConOut->ClearScreen (gST->ConOut);
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);
}

//
// Voice chosen information.
//
Expand Down
10 changes: 3 additions & 7 deletions Library/OcConsoleLib/TextOutputBuiltin.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,12 @@ AsciiTextTestString (
IN CHAR16 *String
)
{
if (StrCmp (String, OC_CONSOLE_CLEAR_AND_CLIP) == 0) {
This->ClearScreen (This);
mConsoleMaxPosX = 0;
mConsoleMaxPosY = 0;
} else if (StrCmp (String, OC_CONSOLE_CLEAR_WHOLE_AND_CLIP) == 0) {
if (StrCmp (String, OC_CONSOLE_MARK_UNCONTROLLED) == 0) {
mConsoleMaxPosX = mGraphicsOutput->Mode->Info->HorizontalResolution / TGT_CHAR_WIDTH;
mConsoleMaxPosY = mGraphicsOutput->Mode->Info->VerticalResolution / TGT_CHAR_HEIGHT;
This->ClearScreen (This);
} else if (StrCmp (String, OC_CONSOLE_MARK_CONTROLLED) == 0) {
mConsoleMaxPosX = 0;
mConsoleMaxPosX = 0;
mConsoleMaxPosY = 0;
}

return EFI_SUCCESS;
Expand Down
14 changes: 14 additions & 0 deletions Platform/OpenCanopy/OcBootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcConsoleLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
Expand All @@ -29,6 +31,7 @@
#include "GuiApp.h"

extern BOOT_PICKER_GUI_CONTEXT mGuiContext;
extern CONST GUI_IMAGE mBackgroundImage;

STATIC
GUI_DRAWING_CONTEXT
Expand Down Expand Up @@ -58,6 +61,11 @@ OcShowMenuByOc (
return Status;
}

//
// Extension for OpenCore builtin renderer to mark that we control text output here.
//
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED);

Status = BootPickerViewInitialize (
&mDrawContext,
&mGuiContext,
Expand Down Expand Up @@ -88,9 +96,15 @@ OcShowMenuByOc (
// Note, it is important to destruct GUI here, as we must ensure
// that keyboard/mouse polling does not conflict with FV2 ui.
//
GuiClearScreen (&mDrawContext, mBackgroundImage.Buffer);
BootPickerViewDeinitialize (&mDrawContext, &mGuiContext);
GuiLibDestruct ();

//
// Extension for OpenCore builtin renderer to mark that we no longer control text output here.
//
gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);

*ChosenBootEntry = mGuiContext.BootEntry;
BootContext->PickerContext->HideAuxiliary = mGuiContext.HideAuxiliary;
if (mGuiContext.Refresh) {
Expand Down
20 changes: 20 additions & 0 deletions Platform/OpenCanopy/OpenCanopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,26 @@ GuiDrawLoop (
} while (!DrawContext->ExitLoop (DrawContext->GuiContext));
}

VOID
GuiClearScreen (
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Pixel
)
{
GuiOutputBlt (
mOutputContext,
Pixel,
EfiBltVideoFill,
0,
0,
0,
0,
DrawContext->Screen->Width,
DrawContext->Screen->Height,
0
);
}

EFI_STATUS
GuiIcnsToImageIcon (
OUT GUI_IMAGE *Image,
Expand Down
6 changes: 6 additions & 0 deletions Platform/OpenCanopy/OpenCanopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ GuiDrawLoop (
IN UINT32 TimeoutSeconds
);

VOID
GuiClearScreen (
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Pixel
);

EFI_STATUS
GuiLibConstruct (
IN UINT32 CursorDefaultX,
Expand Down

0 comments on commit 76e889f

Please sign in to comment.