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

Method FromPNG

rEFIt_UEFI/libeg/XImage.cpp:355–373  ·  view source on GitHub ↗

* The function converted plain array into XImage object * Error = 0 - Success * Error = 28 - invalid signature */

Source from the content-addressed store, hash-verified

353 * Error = 28 - invalid signature
354 */
355EFI_STATUS XImage::FromPNG(const UINT8 * Data, UINTN Length)
356{
357// DBG("XImage len=%llu\n", Length);
358 if (Data == NULL) return EFI_INVALID_PARAMETER;
359 UINT8 * PixelPtr; // = (UINT8 *)&PixelData[0];
360 unsigned Error = eglodepng_decode(&PixelPtr, &Width, &Height, Data, Length);
361 if (Error != 0 && Error != 28) {
362 return EFI_NOT_FOUND;
363 }
364 if ( !PixelPtr ) return EFI_UNSUPPORTED; // It's possible to get error 28 and PixelPtr == NULL
365 setSizeInPixels(Width, Height);
366 //now we have a new pointer and want to move data
367 INTN NewLength = Width * Height * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
368 CopyMem(GetPixelPtr(0,0), PixelPtr, NewLength);
369 FreePool(PixelPtr); //allocated by lodepng
370
371 FlipRB();
372 return EFI_SUCCESS;
373}
374
375/*
376 * The function creates new array Data and inform about it size to be saved

Callers 9

FillinCustomEntryFunction · 0.80
FillingCustomLegacyFunction · 0.80
FillingCustomToolFunction · 0.80
GetEarlyUserSettingsFunction · 0.80
LoadFontImageMethod · 0.80
FillByEmbeddedMethod · 0.80
InitBarMethod · 0.80
parseImageFunction · 0.80
InitBootScreenFunction · 0.80

Calls 3

eglodepng_decodeFunction · 0.85
CopyMemFunction · 0.50
FreePoolFunction · 0.50

Tested by

no test coverage detected