~paravoid/Demos

129d62ff7563b6d162531da14bf4a5281e890719 — paravoid 2 years ago 32870e0
screenshot: Use a proper GOP instance for blt
1 files changed, 5 insertions(+), 3 deletions(-)

M efigop/screenshot/efiboot.c
M efigop/screenshot/efiboot.c => efigop/screenshot/efiboot.c +5 -3
@@ 1071,6 1071,7 @@ Xscreenshot_efi() {
	void *pixels;
	UINTN picsize;
	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi;
	EFI_GRAPHICS_OUTPUT	*second_gop = NULL;
	EFI_GUID fs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL;
	EFI_FILE_IO_INTERFACE *IOVolume;
	EFI_FILE_HANDLE Volume;


@@ 1079,12 1080,13 @@ Xscreenshot_efi() {
	UINTN nhandles;
	EFI_HANDLE *handles = NULL;

	BS->LocateProtocol(&gop_guid, NULL, (void **)&gop);
	gopi = gop->Mode->Info;
	BS->LocateHandleBuffer(ByProtocol, &gop_guid, NULL, &nhandles, &handles);
	BS->HandleProtocol(handles[1], &gop_guid, (void **)&second_gop);
	gopi = second_gop->Mode->Info;
	picsize = gopi->VerticalResolution * gopi->PixelsPerScanLine * 4;
	BS->AllocatePool(EfiLoaderData, picsize, &pixels);
	/* This, Buffer, Operation, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta (not needed here) */
	gop->Blt(gop, pixels, EfiBltVideoToBltBuffer, 0, 0, 0, 0, gopi->HorizontalResolution, gopi->VerticalResolution, 0);
	second_gop->Blt(second_gop, pixels, EfiBltVideoToBltBuffer, 0, 0, 0, 0, gopi->HorizontalResolution, gopi->VerticalResolution, 0);

	BS->LocateHandleBuffer(ByProtocol, &fs_guid, NULL, &nhandles, &handles);
	BS->HandleProtocol(handles[0], &fs_guid, (void **)&IOVolume);