MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / egScreenShot

Function egScreenShot

rEFIt_UEFI/libeg/libscreen.cpp:535–570  ·  view source on GitHub ↗

Make a screenshot

Source from the content-addressed store, hash-verified

533// Make a screenshot
534//
535EFI_STATUS egScreenShot(VOID)
536{
537 EFI_STATUS Status = EFI_NOT_READY;
538 //take screen
539 XImage Screen(egScreenWidth, egScreenHeight);
540 MsgLog("Make screenshot W=%llu H=%llu\n", egScreenWidth, egScreenHeight);
541 Screen.GetArea(0, 0, egScreenWidth, egScreenHeight);
542 //convert to PNG
543 UINT8 *FileData = NULL;
544 UINTN FileDataLength = 0U;
545 Status = Screen.ToPNG(&FileData, FileDataLength);
546 if (EFI_ERROR(Status)) {
547 if (FileData != NULL) {
548 FreePool(FileData);
549 }
550 return Status;
551 }
552 if (!FileData) {
553 return EFI_NOT_READY;
554 }
555 //save file with a first unoccupied name
556 for (UINTN Index = 0; Index < 60; Index++) {
557 XStringW Name = SWPrintf("EFI\\CLOVER\\misc\\screenshot%lld.png", Index);
558 if (!FileExists(SelfRootDir, Name.wc_str())) {
559 Status = egSaveFile(SelfRootDir, Name.wc_str(), FileData, FileDataLength);
560 if (EFI_ERROR(Status))
561 Status = egSaveFile(NULL, Name.wc_str(), FileData, FileDataLength);
562
563 if (!EFI_ERROR(Status)) {
564 break;
565 }
566 }
567 }
568 FreePool(FileData);
569 return Status;
570}
571
572//
573// Sets mode via GOP protocol, and reconnects simple text out drivers

Callers 2

InputDialogMethod · 0.85
RunGenericMenuMethod · 0.85

Calls 7

SWPrintfFunction · 0.85
FileExistsFunction · 0.85
egSaveFileFunction · 0.85
GetAreaMethod · 0.80
ToPNGMethod · 0.80
FreePoolFunction · 0.50
wc_strMethod · 0.45

Tested by

no test coverage detected