mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
separated EG_IMAGE to exclude them
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
509981b16c
commit
79af8de0a0
@ -2288,6 +2288,7 @@
|
||||
A51F63C922DFB81700086DB7 /* AppleApfsInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleApfsInfo.h; sourceTree = "<group>"; };
|
||||
A51F63CA22DFB84500086DB7 /* ApfsEfiBootRecordInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApfsEfiBootRecordInfo.h; sourceTree = "<group>"; };
|
||||
A51F63CB22DFB86F00086DB7 /* ApplePartitionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePartitionInfo.h; sourceTree = "<group>"; };
|
||||
A523130F2448792B00421FB2 /* image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = image.h; sourceTree = "<group>"; };
|
||||
A5429219233538250001F42A /* Clover */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Clover; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A5456CC423FC5A81000BF18C /* CanonicalDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanonicalDB.h; sourceTree = "<group>"; };
|
||||
A5456CC623FC5A81000BF18C /* securemenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = securemenu.cpp; sourceTree = "<group>"; };
|
||||
@ -6182,6 +6183,7 @@
|
||||
A5456CE723FC5AB0000BF18C /* FloatLib.h */,
|
||||
A5456CF623FC5AB7000BF18C /* ftol.asm */,
|
||||
A5456CE823FC5AB0000BF18C /* image.cpp */,
|
||||
A523130F2448792B00421FB2 /* image.h */,
|
||||
A5456CE423FC5AAE000BF18C /* libeg.h */,
|
||||
A5456CE523FC5AAF000BF18C /* libegint.h */,
|
||||
A5456CE223FC5AAE000BF18C /* libscreen.cpp */,
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
extern CONST CHAR8* IconsNames[];
|
||||
|
||||
#if 0
|
||||
#if USE_EG_IMAGE
|
||||
static CONST CHAR16 *BuiltinIconNames[] = {
|
||||
/*
|
||||
L"About",
|
||||
|
@ -84,25 +84,7 @@ VOID AddSecureBootTool(VOID)
|
||||
Entry->AtRightClick = ActionHelp;
|
||||
MainMenu.AddMenuEntry(Entry);
|
||||
}
|
||||
/*
|
||||
typedef struct _refit_menu_entry {
|
||||
CHAR16 *Title;
|
||||
UINTN Tag;
|
||||
UINTN Row;
|
||||
CHAR16 ShortcutDigit;
|
||||
CHAR16 ShortcutLetter;
|
||||
EG_IMAGE *Image;
|
||||
EG_IMAGE *DriveImage;
|
||||
EG_IMAGE *BadgeImage;
|
||||
EG_RECT Place;
|
||||
ACTION AtClick;
|
||||
ACTION AtDoubleClick;
|
||||
ACTION AtRightClick;
|
||||
ACTION AtMouseOver;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
} REFIT_MENU_ENTRY;
|
||||
|
||||
*/
|
||||
|
||||
STATIC REFIT_MENU_ENTRY QueryEntry[] = {
|
||||
{ L"Deny authentication"_XSW, SECURE_BOOT_POLICY_DENY, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL },
|
||||
|
@ -150,7 +150,7 @@ static INTN row1Count, row1PosX, row1PosXRunning;
|
||||
static INTN *itemPosX = NULL;
|
||||
static INTN *itemPosY = NULL;
|
||||
static INTN row0PosY, row1PosY, textPosY, FunctextPosY;
|
||||
////static EG_IMAGE* MainImage;
|
||||
|
||||
static INTN OldX = 0, OldY = 0;
|
||||
static INTN OldTextWidth = 0;
|
||||
static UINTN OldRow = 0;
|
||||
@ -1293,7 +1293,6 @@ INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INT
|
||||
INTN XText = 0;
|
||||
INTN Height;
|
||||
INTN TextXYStyle = 1;
|
||||
// EG_IMAGE *TextBufferXY = NULL;
|
||||
XImage TextBufferXY(0,0);
|
||||
|
||||
if (Text.isEmpty()) {
|
||||
|
@ -30,7 +30,7 @@ XImage::XImage(UINTN W, UINTN H)
|
||||
// Height = H; //included below
|
||||
setSizeInPixels(W, H);
|
||||
}
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
XImage::XImage(EG_IMAGE* egImage)
|
||||
{
|
||||
if ( egImage) {
|
||||
@ -58,6 +58,7 @@ EFI_STATUS XImage::FromEGImage(const EG_IMAGE* egImage)
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
XImage& XImage::operator= (const XImage& other)
|
||||
{
|
||||
@ -734,7 +735,7 @@ void XImage::CopyRect(const XImage& Image, const EG_RECT& OwnPlace, const EG_REC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
EG_IMAGE* XImage::ToEGImage()
|
||||
{
|
||||
if (isEmpty()) {
|
||||
@ -744,6 +745,7 @@ EG_IMAGE* XImage::ToEGImage()
|
||||
CopyMem(&Tmp->PixelData[0], &PixelData[0], GetSizeInBytes());
|
||||
return Tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Load an image from a .icns file
|
||||
@ -757,7 +759,8 @@ EFI_STATUS XImage::LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileNam
|
||||
UINT8 *FileData = NULL;
|
||||
UINTN FileDataLength = 0;
|
||||
//TODO - make XImage
|
||||
EG_IMAGE *NewImage;
|
||||
// EG_IMAGE *NewImage;
|
||||
|
||||
|
||||
// load file
|
||||
Status = egLoadFile(BaseDir, FileName, &FileData, &FileDataLength);
|
||||
@ -766,8 +769,9 @@ EFI_STATUS XImage::LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileNam
|
||||
}
|
||||
|
||||
// decode it
|
||||
NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE);
|
||||
Status = FromEGImage(NewImage);
|
||||
// NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE);
|
||||
// Status = FromEGImage(NewImage);
|
||||
Status = FromICNS(FileData, FileDataLength, PixelSize);
|
||||
FreePool(FileData);
|
||||
return Status;
|
||||
|
||||
|
@ -53,7 +53,9 @@ protected:
|
||||
public:
|
||||
XImage();
|
||||
XImage(UINTN W, UINTN H);
|
||||
#if USE_EG_IMAGE
|
||||
XImage(EG_IMAGE* egImage);
|
||||
#endif
|
||||
XImage(const XImage& Image, float scale = 0.f); //the constructor can accept 0 scale as 1.f
|
||||
virtual ~XImage();
|
||||
|
||||
@ -94,8 +96,11 @@ public:
|
||||
EFI_STATUS FromPNG(const UINT8 * Data, UINTN Lenght);
|
||||
EFI_STATUS ToPNG(UINT8** Data, UINTN& OutSize);
|
||||
EFI_STATUS FromSVG(const CHAR8 *SVGData, float scale);
|
||||
EFI_STATUS FromICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize);
|
||||
#if USE_EG_IMAGE
|
||||
EFI_STATUS FromEGImage(const EG_IMAGE* egImage);
|
||||
EG_IMAGE* ToEGImage();
|
||||
#endif
|
||||
void GetArea(const EG_RECT& Rect);
|
||||
void GetArea(INTN x, INTN y, UINTN W, UINTN H);
|
||||
void Draw(INTN x, INTN y, float scale, bool Opaque);
|
||||
|
@ -93,7 +93,7 @@ Image.FromPNG(ACCESS_EMB_DATA(ico), ACCESS_EMB_SIZE(ico)); \
|
||||
ImageNight.FromPNG(ACCESS_EMB_DATA(dark), ACCESS_EMB_SIZE(dark)); \
|
||||
}
|
||||
|
||||
Icon::Icon(INTN Index, bool TakeEmbedded) : Image(0), ImageNight(0)
|
||||
Icon::Icon(INTN Index, bool TakeEmbedded) : Image(), ImageNight()
|
||||
{
|
||||
Id = Index;
|
||||
Name.setEmpty();
|
||||
|
@ -54,7 +54,7 @@
|
||||
//
|
||||
// Basic image handling
|
||||
//
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
EG_IMAGE * egCreateImage(IN INTN Width, IN INTN Height, IN BOOLEAN HasAlpha)
|
||||
{
|
||||
EG_IMAGE *NewImage;
|
||||
@ -184,7 +184,7 @@ VOID egFreeImage(IN EG_IMAGE *Image)
|
||||
FreePool(Image);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// Basic file operations should be separated into separate file
|
||||
//
|
||||
@ -381,6 +381,7 @@ EFI_STATUS egMkDir(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *DirName)
|
||||
|
||||
//will be replaced by Image.LoadXImage(BaseDir, Name);
|
||||
//caller is responsible for free image
|
||||
#if USE_EG_IMAGE
|
||||
EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN BOOLEAN WantAlpha)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -704,6 +705,6 @@ EG_IMAGE * egDecodePNG(IN const UINT8 *FileData, IN UINTN FileDataLength, IN BOO
|
||||
lodepng_free(PixelData);
|
||||
return NewImage;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
@ -9,14 +9,14 @@
|
||||
#define LIBEG_IMAGE_H_
|
||||
|
||||
|
||||
|
||||
#ifdef USE_EG_IMAGE
|
||||
EG_IMAGE
|
||||
*egDecodePNG (
|
||||
IN const UINT8 *FileData,
|
||||
IN UINTN FileDataLength,
|
||||
IN BOOLEAN WantAlpha
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* LIBEG_IMAGE_H_ */
|
||||
|
@ -37,6 +37,8 @@
|
||||
#ifndef __LIBEG_LIBEG_H__
|
||||
#define __LIBEG_LIBEG_H__
|
||||
|
||||
#define USE_EG_IMAGE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -380,28 +382,15 @@ typedef union {
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
|
||||
*/
|
||||
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
typedef struct {
|
||||
INTN Width;
|
||||
INTN Height;
|
||||
EG_PIXEL *PixelData;
|
||||
BOOLEAN HasAlpha; //moved here to avoid alignment issue
|
||||
} EG_IMAGE;
|
||||
/*
|
||||
typedef struct GUI_ANIME GUI_ANIME;
|
||||
struct GUI_ANIME {
|
||||
UINTN ID;
|
||||
CHAR16 *Path;
|
||||
UINTN Frames;
|
||||
UINTN FrameTime;
|
||||
INTN FilmX, FilmY; //relative
|
||||
INTN ScreenEdgeHorizontal;
|
||||
INTN ScreenEdgeVertical;
|
||||
INTN NudgeX, NudgeY;
|
||||
BOOLEAN Once;
|
||||
GUI_ANIME *Next;
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
class EG_RECT {
|
||||
public:
|
||||
@ -440,15 +429,6 @@ typedef struct EG_RECT {
|
||||
#define EG_EICOMPMODE_RLE (1)
|
||||
#define EG_EICOMPMODE_EFICOMPRESS (2)
|
||||
|
||||
|
||||
typedef struct {
|
||||
EG_IMAGE *Image;
|
||||
CONST CHAR16 *Path;
|
||||
CONST CHAR16 *Format;
|
||||
UINTN PixelSize;
|
||||
} BUILTIN_ICON;
|
||||
|
||||
|
||||
/* functions */
|
||||
|
||||
VOID egInitScreen(IN BOOLEAN SetMaxResolution);
|
||||
@ -466,7 +446,7 @@ VOID egSetGraphicsModeEnabled(IN BOOLEAN Enable);
|
||||
// call egSetGraphicsModeEnabled(FALSE) to ensure the system
|
||||
// is running in text mode. egHasGraphicsMode() only determines
|
||||
// if libeg can draw to the screen in graphics mode.
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
EG_IMAGE * egCreateImage(IN INTN Width, IN INTN Height, IN BOOLEAN HasAlpha);
|
||||
EG_IMAGE * egCreateFilledImage(IN INTN Width, IN INTN Height, IN BOOLEAN HasAlpha, IN EG_PIXEL *Color);
|
||||
EG_IMAGE * egCopyImage(IN EG_IMAGE *Image);
|
||||
@ -478,24 +458,25 @@ EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN
|
||||
EG_IMAGE * egLoadIcon(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN UINTN IconSize);
|
||||
|
||||
EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color);
|
||||
|
||||
#endif
|
||||
EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName,
|
||||
OUT UINT8 **FileData, OUT UINTN *FileDataLength);
|
||||
EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *FileName,
|
||||
IN CONST VOID *FileData, IN UINTN FileDataLength);
|
||||
EFI_STATUS egMkDir(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *DirName);
|
||||
EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir);
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
VOID egFillImage(IN OUT EG_IMAGE *CompImage, IN EG_PIXEL *Color);
|
||||
VOID egFillImageArea(IN OUT EG_IMAGE *CompImage,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN INTN AreaWidth, IN INTN AreaHeight,
|
||||
IN EG_PIXEL *Color);
|
||||
VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN INTN PosX, IN INTN PosY);
|
||||
|
||||
#endif
|
||||
|
||||
VOID egClearScreen(IN const void *Color);
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
//VOID egDrawImage(IN EG_IMAGE *Image, IN INTN ScreenPosX, IN INTN ScreenPosY);
|
||||
// will be replaced by XImage.Draw(ScreenPosX, ScreenPosY, 1.f); assuming Area* = 0
|
||||
VOID egDrawImageArea(IN EG_IMAGE *Image,
|
||||
@ -504,7 +485,7 @@ VOID egDrawImageArea(IN EG_IMAGE *Image,
|
||||
IN INTN ScreenPosX, IN INTN ScreenPosY);
|
||||
VOID egTakeImage(IN EG_IMAGE *Image, INTN ScreenPosX, INTN ScreenPosY,
|
||||
IN INTN AreaWidth, IN INTN AreaHeight);
|
||||
|
||||
#endif
|
||||
EFI_STATUS egScreenShot(VOID);
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ DECLARE_EMB_EXTERN_WITH_SIZE(emb_dark_checkbox_checked)
|
||||
//typedef EG_IMAGE * (*EG_DECODE_FUNC)(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha);
|
||||
|
||||
/* functions */
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
VOID egRestrictImageArea(IN EG_IMAGE *Image,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN OUT INTN *AreaWidth, IN OUT INTN *AreaHeight);
|
||||
@ -177,7 +177,7 @@ VOID egRawComposeOnFlat(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
|
||||
EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha);
|
||||
|
||||
EG_IMAGE * egDecodePNG(IN const UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha);
|
||||
|
||||
#endif
|
||||
|
||||
//VOID egEncodeBMP(IN EG_IMAGE *Image, OUT UINT8 **FileData, OUT UINTN *FileDataLength);
|
||||
|
||||
|
@ -531,7 +531,7 @@ VOID egClearScreen(IN const void *Color)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
VOID egDrawImageArea(IN EG_IMAGE *Image,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN INTN AreaWidth, IN INTN AreaHeight,
|
||||
@ -615,7 +615,7 @@ VOID egTakeImage(IN EG_IMAGE *Image, INTN ScreenPosX, INTN ScreenPosY,
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// Make a screenshot
|
||||
//
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
//#if !defined(LODEPNG)
|
||||
#include "libegint.h"
|
||||
#include "XImage.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_IMG 0
|
||||
@ -47,8 +48,11 @@
|
||||
#else
|
||||
#define DBG(...) DebugLog(DEBUG_IMG, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
#define PLPTR(imagevar, colorname) ((UINT8 *) &((imagevar)->PixelData->colorname))
|
||||
#else
|
||||
#define PLPTR(imagevar, colorname) ((UINT8 *) &((imagevar).GetPixelPtr(0,0)->colorname))
|
||||
#endif
|
||||
|
||||
|
||||
//these functions used for icns, not with png
|
||||
@ -148,22 +152,22 @@ VOID egDecompressIcnsRLE(IN OUT UINT8 **CompData, IN OUT UINTN *CompLen, IN UINT
|
||||
// Load Apple .icns icons
|
||||
//
|
||||
|
||||
EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha)
|
||||
EFI_STATUS XImage::FromICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize)
|
||||
{
|
||||
EG_IMAGE *NewImage;
|
||||
// EG_IMAGE *NewImage;
|
||||
UINT8 *Ptr, *BufferEnd, *DataPtr, *MaskPtr;
|
||||
UINT32 BlockLen, DataLen, MaskLen;
|
||||
UINTN FetchPixelSize, PixelCount, i;
|
||||
UINT8 *CompData;
|
||||
UINTN CompLen;
|
||||
UINT8 *SrcPtr;
|
||||
EG_PIXEL *DestPtr;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *DestPtr;
|
||||
|
||||
if (FileDataLength < 8 || FileData == NULL ||
|
||||
FileData[0] != 'i' || FileData[1] != 'c' || FileData[2] != 'n' || FileData[3] != 's') {
|
||||
// not an icns file...
|
||||
DBG("not icns\n");
|
||||
return NULL;
|
||||
return EFI_NOT_FOUND; //it is null at this moment
|
||||
}
|
||||
|
||||
FetchPixelSize = IconSize;
|
||||
@ -236,13 +240,14 @@ EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN Ic
|
||||
|
||||
if (DataPtr == NULL) {
|
||||
DBG("not found such IconSize\n");
|
||||
return NULL; // no image found
|
||||
return EFI_NOT_FOUND; // no image found
|
||||
}
|
||||
|
||||
// allocate image structure and buffer
|
||||
NewImage = egCreateImage(FetchPixelSize, FetchPixelSize, WantAlpha);
|
||||
if (NewImage == NULL)
|
||||
return NULL;
|
||||
// NewImage = egCreateImage(FetchPixelSize, FetchPixelSize, WantAlpha);
|
||||
// if (NewImage == NULL)
|
||||
// return NULL;
|
||||
setSizeInPixels(FetchPixelSize, FetchPixelSize);
|
||||
PixelCount = FetchPixelSize * FetchPixelSize;
|
||||
|
||||
if (DataLen < PixelCount * 3) {
|
||||
@ -250,36 +255,36 @@ EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN Ic
|
||||
// pixel data is compressed, RGB planar
|
||||
CompData = DataPtr;
|
||||
CompLen = DataLen;
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, r), PixelCount);
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, g), PixelCount);
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, b), PixelCount);
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(*this, Red), PixelCount);
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(*this, Green), PixelCount);
|
||||
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(*this, Blue), PixelCount);
|
||||
// possible assertion: CompLen == 0
|
||||
if (CompLen > 0) {
|
||||
DBG(" egLoadICNSIcon: %llu bytes of compressed data left\n", CompLen);
|
||||
DBG(" egLoadICNSIcon: %llu bytes of compressed data left\n", CompLen);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// pixel data is uncompressed, RGB interleaved
|
||||
SrcPtr = DataPtr;
|
||||
DestPtr = NewImage->PixelData;
|
||||
DestPtr = GetPixelPtr(0,0);
|
||||
for (i = 0; i < PixelCount; i++, DestPtr++) {
|
||||
DestPtr->r = *SrcPtr++;
|
||||
DestPtr->g = *SrcPtr++;
|
||||
DestPtr->b = *SrcPtr++;
|
||||
DestPtr->Red = *SrcPtr++;
|
||||
DestPtr->Green = *SrcPtr++;
|
||||
DestPtr->Blue = *SrcPtr++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add/set alpha plane
|
||||
if (MaskPtr != NULL && MaskLen >= PixelCount && WantAlpha)
|
||||
egInsertPlane(MaskPtr, PLPTR(NewImage, a), PixelCount);
|
||||
if (MaskPtr != NULL && MaskLen >= PixelCount)
|
||||
egInsertPlane(MaskPtr, PLPTR(*this, Reserved), PixelCount);
|
||||
else
|
||||
egSetPlane(PLPTR(NewImage, a), WantAlpha ? 255 : 0, PixelCount);
|
||||
egSetPlane(PLPTR(*this, Reserved), 255, PixelCount);
|
||||
|
||||
// FUTURE: scale to originally requested size if we had to load another size
|
||||
|
||||
return NewImage;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//#endif
|
||||
/* EOF */
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "nanosvg.h"
|
||||
#include "FloatLib.h"
|
||||
#include "../Platform/b64cdecode.h"
|
||||
#include "image.h"
|
||||
#include "XImage.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_SVG 0
|
||||
@ -3172,7 +3172,8 @@ static void parseImage(NSVGparser* p, const char** dict)
|
||||
float w,h;
|
||||
const char *href = NULL;
|
||||
UINT8 *tmpData = NULL;
|
||||
EG_IMAGE *NewImage = NULL;
|
||||
// EG_IMAGE *NewImage = NULL;
|
||||
XImage *NewImage = new XImage;
|
||||
|
||||
for (i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "width") == 0) {
|
||||
@ -3196,7 +3197,8 @@ static void parseImage(NSVGparser* p, const char** dict)
|
||||
if (len == 0) {
|
||||
DBG("image not decoded from base64\n");
|
||||
}
|
||||
NewImage = egDecodePNG(tmpData, len, TRUE);
|
||||
// NewImage = egDecodePNG(tmpData, len, TRUE);
|
||||
NewImage->FromPNG(tmpData, len);
|
||||
pt->image = (void *)NewImage;
|
||||
if (tmpData) {
|
||||
FreePool(tmpData);
|
||||
|
@ -1212,37 +1212,40 @@ static void nsvg__scanlineSolid(unsigned char* row, int count, unsigned char* co
|
||||
// TODO
|
||||
float fx, fy, dx, gx, gy;
|
||||
float* t = cache->xform;
|
||||
EG_IMAGE *Pattern = (EG_IMAGE *)cache->image;
|
||||
// EG_IMAGE *Pattern = (EG_IMAGE *)cache->image;
|
||||
XImage *Pattern = (XImage*)cache->image;
|
||||
if (!Pattern) {
|
||||
DBG("no pattern to fill\n");
|
||||
return;
|
||||
}
|
||||
INTN Width = Pattern->Width;
|
||||
INTN Height = Pattern->Height;
|
||||
int i, cr, cg, cb, ca, ix, iy;
|
||||
INTN j;
|
||||
INTN Width = Pattern->GetWidth();
|
||||
INTN Height = Pattern->GetHeight();
|
||||
int ix, iy;
|
||||
// INTN j;
|
||||
fx = (float)x;
|
||||
fy = (float)y;
|
||||
dx = 1.0f;
|
||||
|
||||
// unsigned int c;
|
||||
for (i = 0; i < count; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
int r,g,b,a,ia;
|
||||
gx = fx*t[0] + fy*t[2] + t[4];
|
||||
gy = fx*t[1] + fy*t[3] + t[5];
|
||||
ix = dither(gx * Width, 2) % Width;
|
||||
iy = dither(gy * Height, 2) % Height;
|
||||
j = iy * Width + ix;
|
||||
cr = Pattern->PixelData[j].r;
|
||||
cb = Pattern->PixelData[j].b;
|
||||
cg = Pattern->PixelData[j].g;
|
||||
ca = Pattern->PixelData[j].a;
|
||||
a = nsvg__div255((int)cover[0] * ca);
|
||||
// j = iy * Width + ix;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL cp = Pattern->GetPixel(ix, iy);
|
||||
// cr = Pattern->PixelData[j].r;
|
||||
// cb = Pattern->PixelData[j].b;
|
||||
// cg = Pattern->PixelData[j].g;
|
||||
// ca = Pattern->PixelData[j].a;
|
||||
// cr = cp.Red;
|
||||
a = nsvg__div255((int)cover[0] * cp.Reserved);
|
||||
ia = 255 - a;
|
||||
// Premultiply
|
||||
r = nsvg__div255(cr * a);
|
||||
g = nsvg__div255(cg * a);
|
||||
b = nsvg__div255(cb * a);
|
||||
r = nsvg__div255(cp.Red * a);
|
||||
g = nsvg__div255(cp.Green * a);
|
||||
b = nsvg__div255(cp.Blue * a);
|
||||
|
||||
// Blend over
|
||||
r += nsvg__div255(ia * (int)dst[0]);
|
||||
|
@ -198,6 +198,7 @@ typedef enum {
|
||||
MouseMove
|
||||
} MOUSE_EVENT;
|
||||
*/
|
||||
/*
|
||||
typedef struct _pointers {
|
||||
EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
|
||||
EG_IMAGE *Pointer;
|
||||
@ -211,7 +212,7 @@ typedef struct _pointers {
|
||||
EFI_SIMPLE_POINTER_STATE State;
|
||||
MOUSE_EVENT MouseEvent;
|
||||
} POINTERS;
|
||||
|
||||
*/
|
||||
//GUI types
|
||||
|
||||
|
||||
|
@ -71,9 +71,9 @@ static BOOLEAN IsImageWithinScreenLimits(INTN Value, INTN ImageDimension, INTN S
|
||||
static INTN RepositionFixedByCenter(INTN Value, INTN ScreenDimension, INTN DesignScreenDimension);
|
||||
static INTN RepositionRelativeByGapsOnEdges(INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension);
|
||||
INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension);
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
EG_IMAGE * LoadSvgFrame(INTN i);
|
||||
|
||||
#endif
|
||||
// UGA defines and variables
|
||||
|
||||
INTN UGAWidth;
|
||||
@ -341,7 +341,7 @@ typedef struct {
|
||||
// moreover it is class EG_RECT;
|
||||
//same as EgRect but INTN <-> UINTN
|
||||
*/
|
||||
|
||||
#if USE_EG_IMAGE
|
||||
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos)
|
||||
{
|
||||
if (!Image) {
|
||||
@ -393,7 +393,7 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *
|
||||
egDrawImageArea(NewImage, 0, 0, 0, 0, XPos, YPos);
|
||||
egFreeImage(NewImage);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
--------------------------------------------------------------------
|
||||
Pos : Bottom -> Mid -> Top
|
||||
|
@ -11,12 +11,13 @@ VOID SetNextScreenMode(INT32);
|
||||
|
||||
VOID SwitchToGraphicsAndClear(VOID);
|
||||
VOID BltClearScreen();
|
||||
#if USE_EG_IMAGE
|
||||
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
|
||||
VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *BackgroundPixel, INTN Scale);
|
||||
//VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos);
|
||||
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
||||
//VOID BltImageCompositeIndicator(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
||||
|
||||
#endif
|
||||
|
||||
INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension);
|
||||
INTN CalculateNudgePosition(INTN Position, INTN NudgeValue, INTN ImageDimension, INTN ScreenDimension);
|
||||
|
Loading…
Reference in New Issue
Block a user