mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-01 22:41:28 +01:00
testing draw, not working
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
564a3ca06c
commit
d71acbb41d
@ -39,7 +39,7 @@ set PYTHON3_ENABLE=TRUE
|
|||||||
set DEFAULT_NASM_PREFIX=
|
set DEFAULT_NASM_PREFIX=
|
||||||
rem C:\Program Files (x86)\NASM"
|
rem C:\Program Files (x86)\NASM"
|
||||||
rem # %DEFAULT_CYGWIN_HOME%\bin
|
rem # %DEFAULT_CYGWIN_HOME%\bin
|
||||||
set DEFAULT_TOOLCHAIN=VS2017
|
set DEFAULT_TOOLCHAIN=VS2015x86
|
||||||
set DEFAULT_BUILDTARGET=RELEASE
|
set DEFAULT_BUILDTARGET=RELEASE
|
||||||
set DEFAULT_TARGETARCH=X64
|
set DEFAULT_TARGETARCH=X64
|
||||||
set DEFAULT_THREADNUMBER=%NUMBER_OF_PROCESSORS%
|
set DEFAULT_THREADNUMBER=%NUMBER_OF_PROCESSORS%
|
||||||
|
@ -135,7 +135,7 @@ template<class TYPE>
|
|||||||
XArray<TYPE>::XArray(const XArray<TYPE> &anArray)
|
XArray<TYPE>::XArray(const XArray<TYPE> &anArray)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
Add(anArray.Data(), anArray.Length());
|
AddArray(anArray.Data(), anArray.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* operator = */
|
/* operator = */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "menu_items/menu_items.h"
|
#include "menu_items/menu_items.h"
|
||||||
#include "REFIT_MENU_SCREEN.h"
|
#include "REFIT_MENU_SCREEN.h"
|
||||||
|
|
||||||
XPointer REFIT_MENU_SCREEN::mPointer;
|
//XPointer REFIT_MENU_SCREEN::mPointer;
|
||||||
|
@ -64,8 +64,8 @@ typedef VOID (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST C
|
|||||||
class REFIT_MENU_SCREEN
|
class REFIT_MENU_SCREEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static XPointer mPointer;
|
// static XPointer mPointer;
|
||||||
|
XPointer mPointer;
|
||||||
UINTN ID;
|
UINTN ID;
|
||||||
CONST CHAR16 *Title; //Title is not const, but *Title is. It will be better to make it XStringW
|
CONST CHAR16 *Title; //Title is not const, but *Title is. It will be better to make it XStringW
|
||||||
EG_IMAGE *TitleImage;
|
EG_IMAGE *TitleImage;
|
||||||
@ -97,7 +97,7 @@ public:
|
|||||||
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText)
|
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText)
|
||||||
@ -105,14 +105,14 @@ public:
|
|||||||
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
||||||
: ID(ID), Title(Title), TitleImage(0),
|
: ID(ID), Title(Title), TitleImage(0),
|
||||||
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{
|
{
|
||||||
Entries.AddReference(entry1, false);
|
Entries.AddReference(entry1, false);
|
||||||
Entries.AddReference(entry2, false);
|
Entries.AddReference(entry2, false);
|
||||||
|
@ -391,7 +391,7 @@ typedef VOID (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST C
|
|||||||
class REFIT_MENU_SCREEN
|
class REFIT_MENU_SCREEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static XPointer mPointer;
|
XPointer mPointer;
|
||||||
|
|
||||||
UINTN ID;
|
UINTN ID;
|
||||||
CONST CHAR16 *Title; //Title is not const, but *Title is. It will be better to make it XStringW
|
CONST CHAR16 *Title; //Title is not const, but *Title is. It will be better to make it XStringW
|
||||||
@ -424,7 +424,7 @@ public:
|
|||||||
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer() //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText)
|
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText)
|
||||||
@ -432,14 +432,14 @@ public:
|
|||||||
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer() //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
||||||
: ID(ID), Title(Title), TitleImage(0),
|
: ID(ID), Title(Title), TitleImage(0),
|
||||||
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0),
|
||||||
Once(0), LastDraw(0), CurrentFrame(0),
|
Once(0), LastDraw(0), CurrentFrame(0),
|
||||||
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
|
||||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
Film(0), mAction(ActionNone), mItemID(0), mPointer() //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{
|
{
|
||||||
Entries.AddReference(entry1, false);
|
Entries.AddReference(entry1, false);
|
||||||
Entries.AddReference(entry2, false);
|
Entries.AddReference(entry2, false);
|
||||||
|
@ -746,17 +746,25 @@ VOID testSVG()
|
|||||||
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage->PixelData, (int)Width, (int)Height, (int)Width*4);
|
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage->PixelData, (int)Width, (int)Height, (int)Width*4);
|
||||||
DBG("timing rasterize end\n");
|
DBG("timing rasterize end\n");
|
||||||
//now show it!
|
//now show it!
|
||||||
|
#if 1 //test XImage
|
||||||
|
XImage NewX(NewImage);
|
||||||
|
NewX.Draw((UGAWidth - Width) / 2,
|
||||||
|
(UGAHeight - Height) / 2, 1.f);
|
||||||
|
#else
|
||||||
BltImageAlpha(NewImage,
|
BltImageAlpha(NewImage,
|
||||||
(UGAWidth - Width) / 2,
|
(UGAWidth - Width) / 2,
|
||||||
(UGAHeight - Height) / 2,
|
(UGAHeight - Height) / 2,
|
||||||
&MenuBackgroundPixel,
|
&MenuBackgroundPixel,
|
||||||
16);
|
16);
|
||||||
|
#endif //test XImage
|
||||||
FreePool(FileData);
|
FreePool(FileData);
|
||||||
FileData = NULL;
|
FileData = NULL;
|
||||||
egFreeImage(NewImage);
|
egFreeImage(NewImage);
|
||||||
nsvg__deleteParser(p);
|
nsvg__deleteParser(p);
|
||||||
nsvgDeleteRasterizer(rast);
|
nsvgDeleteRasterizer(rast);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//Test text
|
//Test text
|
||||||
Height = 80;
|
Height = 80;
|
||||||
|
@ -19,13 +19,19 @@ XImage::XImage()
|
|||||||
{
|
{
|
||||||
Width = 0;
|
Width = 0;
|
||||||
Height = 0;
|
Height = 0;
|
||||||
|
PixelData = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
XImage::XImage(UINTN W, UINTN H)
|
XImage::XImage(UINTN W, UINTN H)
|
||||||
{
|
{
|
||||||
Width = W;
|
Width = W;
|
||||||
Height = H;
|
Height = H;
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.CheckSize(GetWidth()*GetHeight()); // change the allocated size, but not the size. size is still 0 here. PixelData[0] won't work.
|
PixelData.CheckSize(GetWidth()*GetHeight()); // change the allocated size, but not the size. size is still 0 here. PixelData[0] won't work.
|
||||||
|
PixelData.SetLength(GetWidth()*GetHeight());
|
||||||
|
#else
|
||||||
|
PixelData = (__typeof__(PixelData))AllocatePool(W * H * sizeof(*PixelData));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
XImage::XImage(EG_IMAGE* egImage)
|
XImage::XImage(EG_IMAGE* egImage)
|
||||||
@ -37,11 +43,15 @@ XImage::XImage(EG_IMAGE* egImage)
|
|||||||
Width = 0;
|
Width = 0;
|
||||||
Height = 0;
|
Height = 0;
|
||||||
}
|
}
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.CheckSize(GetWidth()*GetHeight()); // change the allocated size, but not the size.
|
PixelData.CheckSize(GetWidth()*GetHeight()); // change the allocated size, but not the size.
|
||||||
PixelData.SetLength(GetWidth()*GetHeight()); // change the size, ie the number of element in the array
|
PixelData.SetLength(GetWidth()*GetHeight()); // change the size, ie the number of element in the array
|
||||||
if ( GetWidth()*GetHeight() > 0 ) {
|
if ( GetWidth()*GetHeight() > 0 ) {
|
||||||
CopyMem(&PixelData[0], egImage->PixelData, PixelData.size());
|
CopyMem(&PixelData[0], egImage->PixelData, PixelData.size() * sizeof(*egImage->PixelData));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PixelData = (__typeof__(PixelData))AllocateCopyPool(Width * Height * sizeof(*egImage->PixelData), egImage->PixelData);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 Smooth(const UINT8* p, int a01, int a10, int a21, int a12, int dx, int dy, float scale)
|
UINT8 Smooth(const UINT8* p, int a01, int a10, int a21, int a12, int dx, int dy, float scale)
|
||||||
@ -56,7 +66,10 @@ XImage::XImage(const XImage& Image, float scale)
|
|||||||
UINTN SrcHeight = Image.GetHeight();
|
UINTN SrcHeight = Image.GetHeight();
|
||||||
Width = (UINTN)(SrcWidth * scale);
|
Width = (UINTN)(SrcWidth * scale);
|
||||||
Height = (UINTN)(SrcHeight * scale);
|
Height = (UINTN)(SrcHeight * scale);
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.CheckSize(GetWidth()*GetHeight());
|
PixelData.CheckSize(GetWidth()*GetHeight());
|
||||||
|
PixelData.SetLength(GetWidth()*GetHeight());
|
||||||
|
#endif
|
||||||
if (scale < 1.e-4) return;
|
if (scale < 1.e-4) return;
|
||||||
CopyScaled(Image, scale);
|
CopyScaled(Image, scale);
|
||||||
}
|
}
|
||||||
@ -125,12 +138,22 @@ do { \
|
|||||||
|
|
||||||
XImage::~XImage()
|
XImage::~XImage()
|
||||||
{
|
{
|
||||||
|
#if USE_ARRAY
|
||||||
|
FreePool(PixelData);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !USE_ARRAY
|
||||||
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& XImage::GetData() const
|
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& XImage::GetData() const
|
||||||
{
|
{
|
||||||
return PixelData;
|
return PixelData;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* XImage::GetData() const
|
||||||
|
{
|
||||||
|
return &PixelData[0];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* XImage::GetPixelPtr(UINTN x, UINTN y)
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* XImage::GetPixelPtr(UINTN x, UINTN y)
|
||||||
{
|
{
|
||||||
@ -181,10 +204,15 @@ void XImage::CopyScaled(const XImage& Image, float scale)
|
|||||||
|
|
||||||
int Pixel = sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
int Pixel = sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||||
int Row = (int)SrcWidth * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
int Row = (int)SrcWidth * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||||
|
#if !USE_ARRAY
|
||||||
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& Source = Image.GetData();
|
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& Source = Image.GetData();
|
||||||
|
#else
|
||||||
|
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* Source = Image.GetData();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.SetLength(Width*Height); // setLength BEFORE, so GetPixelPtr(x, y)
|
PixelData.SetLength(Width*Height); // setLength BEFORE, so GetPixelPtr(x, y)
|
||||||
|
#endif
|
||||||
for (UINTN y = 0; y < Height; y++)
|
for (UINTN y = 0; y < Height; y++)
|
||||||
{
|
{
|
||||||
int ly = (int)(y / scale);
|
int ly = (int)(y / scale);
|
||||||
@ -282,7 +310,7 @@ unsigned XImage::ToPNG(UINT8** Data, UINTN& OutSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fill XImage object by rater data described in SVG
|
* fill XImage object by raster data described in SVG
|
||||||
* caller should create the object with Width and Height and calculate scale
|
* caller should create the object with Width and Height and calculate scale
|
||||||
* scale = 1 correspond to fill the rect with the image
|
* scale = 1 correspond to fill the rect with the image
|
||||||
* scale = 0.5 will reduce image
|
* scale = 0.5 will reduce image
|
||||||
@ -345,16 +373,25 @@ void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
|||||||
UgaDraw = NULL;
|
UgaDraw = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this should be somewhere else
|
||||||
|
INTN ScreenWidth = 0;
|
||||||
|
INTN ScreenHeight = 0;
|
||||||
|
egGetScreenSize(&ScreenWidth, &ScreenHeight);
|
||||||
|
|
||||||
if (W == 0) W = Width;
|
if (W == 0) W = Width;
|
||||||
if (H == 0) H = Height;
|
if (H == 0) H = Height;
|
||||||
|
|
||||||
// INTN AreaWidth = (x + W > Width) ? (Width - x) : W;
|
INTN AreaWidth = (x + W > (UINTN)ScreenWidth) ? ((UINTN)ScreenWidth - x) : W;
|
||||||
// INTN AreaHeight = (y + H > Height) ? (Height - y) : H;
|
INTN AreaHeight = (y + H > (UINTN)ScreenHeight) ? ((UINTN)ScreenHeight - y) : H;
|
||||||
INTN AreaWidth = (W > Width) ? W : Width;
|
// INTN AreaWidth = (W > Width) ? W : Width;
|
||||||
INTN AreaHeight = (H > Height) ? H : Height;
|
// INTN AreaHeight = (H > Height) ? H : Height;
|
||||||
|
DBG("area is {%d, %d, %d, %d}\n", x, y, W, H);
|
||||||
|
DBG("own width %d and area %d\n", Width, AreaWidth);
|
||||||
|
|
||||||
if (GraphicsOutput != NULL) {
|
if (GraphicsOutput != NULL) {
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.SetLength(AreaWidth*AreaHeight); // setLength BEFORE, so &PixelData[0]
|
PixelData.SetLength(AreaWidth*AreaHeight); // setLength BEFORE, so &PixelData[0]
|
||||||
|
#endif
|
||||||
INTN LineBytes = GraphicsOutput->Mode->Info->HorizontalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
INTN LineBytes = GraphicsOutput->Mode->Info->HorizontalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||||
GraphicsOutput->Blt(GraphicsOutput,
|
GraphicsOutput->Blt(GraphicsOutput,
|
||||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&PixelData[0],
|
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&PixelData[0],
|
||||||
@ -363,14 +400,16 @@ void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
|||||||
}
|
}
|
||||||
else if (UgaDraw != NULL) {
|
else if (UgaDraw != NULL) {
|
||||||
UINT32 LineWidth = 0;
|
UINT32 LineWidth = 0;
|
||||||
UINT32 ScreenHeight = 0;
|
UINT32 UGAScreenHeight = 0;
|
||||||
UINT32 Depth = 0;
|
UINT32 Depth = 0;
|
||||||
UINT32 RefreshRate = 60;
|
UINT32 RefreshRate = 60;
|
||||||
Status = UgaDraw->GetMode(UgaDraw, &LineWidth, &ScreenHeight, &Depth, &RefreshRate);
|
Status = UgaDraw->GetMode(UgaDraw, &LineWidth, &UGAScreenHeight, &Depth, &RefreshRate);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
return; // graphics not available
|
return; // graphics not available
|
||||||
}
|
}
|
||||||
|
#if !USE_ARRAY
|
||||||
PixelData.SetLength(AreaWidth*AreaHeight); // setLength BEFORE, so &PixelData[0]
|
PixelData.SetLength(AreaWidth*AreaHeight); // setLength BEFORE, so &PixelData[0]
|
||||||
|
#endif
|
||||||
UgaDraw->Blt(UgaDraw,
|
UgaDraw->Blt(UgaDraw,
|
||||||
(EFI_UGA_PIXEL *)&PixelData[0],
|
(EFI_UGA_PIXEL *)&PixelData[0],
|
||||||
EfiUgaVideoToBltBuffer,
|
EfiUgaVideoToBltBuffer,
|
||||||
@ -383,16 +422,27 @@ void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
|||||||
|
|
||||||
void XImage::Draw(INTN x, INTN y, float scale)
|
void XImage::Draw(INTN x, INTN y, float scale)
|
||||||
{
|
{
|
||||||
|
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlueColor = { 200, 0, 0, 160 };
|
||||||
//prepare images
|
//prepare images
|
||||||
INTN ScreenWidth = 0;
|
INTN ScreenWidth = 0;
|
||||||
INTN ScreenHeight = 0;
|
INTN ScreenHeight = 0;
|
||||||
egGetScreenSize(&ScreenWidth, &ScreenHeight);
|
egGetScreenSize(&ScreenWidth, &ScreenHeight);
|
||||||
XImage Background(ScreenWidth, ScreenHeight);
|
// DBG("1\n");
|
||||||
Background.GetArea(x, y, Width, Height);
|
// XImage Background(ScreenWidth, ScreenHeight);
|
||||||
XImage Top(*this, scale);
|
// DBG("2\n");
|
||||||
Background.Compose(x, y, Top, true);
|
// Background.GetArea(x, y, Width, Height);
|
||||||
UINTN AreaWidth = (x + Width > Background.GetWidth()) ? (Background.GetWidth() - x) : Width;
|
// DBG("3\n");
|
||||||
UINTN AreaHeight = (y + Height > Background.GetHeight()) ? (Background.GetHeight() - y) : Height;
|
// XImage Top(*this, scale);
|
||||||
|
// XImage Top(Width, Height);
|
||||||
|
// DBG("4\n");
|
||||||
|
// Top.CopyScaled(*this, 1.f);
|
||||||
|
// Top.Fill(BlueColor);
|
||||||
|
// DBG("5\n");
|
||||||
|
// Background.Compose(x, y, Top, true);
|
||||||
|
// DBG("6\n");
|
||||||
|
UINTN AreaWidth = (x + Width > (UINTN)ScreenWidth) ? (ScreenWidth - x) : Width;
|
||||||
|
UINTN AreaHeight = (y + Height > (UINTN)ScreenHeight) ? (ScreenHeight - y) : Height;
|
||||||
|
// DBG("width: own=%d, Background=%d, Area=%d\n", Width, Background.GetWidth(), AreaWidth);
|
||||||
|
|
||||||
// prepare protocols
|
// prepare protocols
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -409,15 +459,17 @@ void XImage::Draw(INTN x, INTN y, float scale)
|
|||||||
UgaDraw = NULL;
|
UgaDraw = NULL;
|
||||||
}
|
}
|
||||||
//output combined image
|
//output combined image
|
||||||
|
// DBG("7\n");
|
||||||
if (GraphicsOutput != NULL) {
|
if (GraphicsOutput != NULL) {
|
||||||
GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Background.GetPixelPtr(0, 0),
|
GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)GetData(),
|
||||||
EfiBltBufferToVideo,
|
EfiBltBufferToVideo,
|
||||||
0, 0, x, y,
|
0, 0, //source x,y
|
||||||
AreaWidth, AreaHeight, Background.GetWidth() * 4);
|
x, y, //destination x,y
|
||||||
|
AreaWidth, AreaHeight, ScreenWidth * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
}
|
}
|
||||||
else if (UgaDraw != NULL) {
|
else if (UgaDraw != NULL) {
|
||||||
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)Background.GetPixelPtr(0, 0), EfiUgaBltBufferToVideo,
|
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)GetPixelPtr(0, 0), EfiUgaBltBufferToVideo,
|
||||||
0, 0, x, y,
|
0, 0, x, y,
|
||||||
AreaWidth, AreaHeight, Background.GetWidth() * 4);
|
AreaWidth, AreaHeight, ScreenWidth * sizeof(EFI_UGA_PIXEL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ extern "C" {
|
|||||||
//#include "nanosvg.h"
|
//#include "nanosvg.h"
|
||||||
//#include "FloatLib.h"
|
//#include "FloatLib.h"
|
||||||
|
|
||||||
|
#define USE_ARRAY 1
|
||||||
|
|
||||||
#if 0 //ndef EFI_GRAPHICS_OUTPUT_BLT_PIXEL
|
#if 0 //ndef EFI_GRAPHICS_OUTPUT_BLT_PIXEL
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -47,7 +48,11 @@ class XImage
|
|||||||
protected:
|
protected:
|
||||||
UINTN Width;
|
UINTN Width;
|
||||||
UINTN Height;
|
UINTN Height;
|
||||||
|
#if USE_ARRAY
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *PixelData;
|
||||||
|
#else
|
||||||
XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL> PixelData;
|
XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL> PixelData;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XImage();
|
XImage();
|
||||||
@ -60,17 +65,29 @@ protected:
|
|||||||
UINTN GetSize() const; //in bytes
|
UINTN GetSize() const; //in bytes
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#if !USE_ARRAY
|
||||||
|
|
||||||
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& GetData() const;
|
const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& GetData() const;
|
||||||
|
#else
|
||||||
|
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetData() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& GetPixel(UINTN x, UINTN y) const;
|
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& GetPixel(UINTN x, UINTN y) const;
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetPixelPtr(UINTN x, UINTN y);
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetPixelPtr(UINTN x, UINTN y);
|
||||||
UINTN GetWidth() const;
|
UINTN GetWidth() const;
|
||||||
UINTN GetHeight() const;
|
UINTN GetHeight() const;
|
||||||
|
|
||||||
|
#if USE_ARRAY
|
||||||
|
void setEmpty() {
|
||||||
|
Width = 0; Height = 0; if (PixelData) {
|
||||||
|
FreePool(PixelData); PixelData = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool isEmpty() const { return PixelData == nullptr; }
|
||||||
|
#else
|
||||||
void setEmpty() { Width=0; Height=0; PixelData.setEmpty(); }
|
void setEmpty() { Width=0; Height=0; PixelData.setEmpty(); }
|
||||||
bool isEmpty() const { return PixelData.size() == 0; }
|
bool isEmpty() const { return PixelData.size() == 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 });
|
void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 });
|
||||||
void FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, const EgRect& Rect);
|
void FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, const EgRect& Rect);
|
||||||
|
@ -60,7 +60,7 @@ EFI_STATUS XPointer::MouseBirth()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SimplePointerProtocol) { //do not double
|
if (SimplePointerProtocol) { //do not double
|
||||||
// DBG("DrawPointer\n");
|
DBG("Mouse is already here\n");
|
||||||
Draw();
|
Draw();
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ EFI_STATUS XPointer::MouseBirth()
|
|||||||
|
|
||||||
if ( PointerImage.isEmpty() ) {
|
if ( PointerImage.isEmpty() ) {
|
||||||
//this is impossible after BuiltinIcon
|
//this is impossible after BuiltinIcon
|
||||||
DBG("No pointer image!\n");
|
MsgLog("No pointer image!\n");
|
||||||
SimplePointerProtocol = NULL;
|
SimplePointerProtocol = NULL;
|
||||||
Alive = false;
|
Alive = false;
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
@ -96,6 +96,7 @@ EFI_STATUS XPointer::MouseBirth()
|
|||||||
oldPlace.Height = POINTER_HEIGHT;
|
oldPlace.Height = POINTER_HEIGHT;
|
||||||
DBG("init mouse at [%d, %d]\n", oldPlace.XPos, oldPlace.YPos);
|
DBG("init mouse at [%d, %d]\n", oldPlace.XPos, oldPlace.YPos);
|
||||||
CopyMem(&newPlace, &oldPlace, sizeof(EG_RECT));
|
CopyMem(&newPlace, &oldPlace, sizeof(EG_RECT));
|
||||||
|
// DBG("newPlace={%d, %d, %d, %d}\n", newPlace.XPos, newPlace.YPos, newPlace.Width, newPlace.Height);
|
||||||
|
|
||||||
//newImage->Fill(&MenuBackgroundPixel),
|
//newImage->Fill(&MenuBackgroundPixel),
|
||||||
// egTakeImage(oldImage, oldPlace.XPos, oldPlace.YPos,
|
// egTakeImage(oldImage, oldPlace.XPos, oldPlace.YPos,
|
||||||
@ -111,13 +112,15 @@ VOID XPointer::Draw()
|
|||||||
|
|
||||||
// take background image
|
// take background image
|
||||||
oldImage.GetArea(newPlace);
|
oldImage.GetArea(newPlace);
|
||||||
|
// DBG("got area\n");
|
||||||
CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ?
|
CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ?
|
||||||
|
|
||||||
// CopyMem(newImage->PixelData, oldImage->PixelData, (UINTN)(POINTER_WIDTH * POINTER_HEIGHT * sizeof(EG_PIXEL)));
|
// CopyMem(newImage->PixelData, oldImage->PixelData, (UINTN)(POINTER_WIDTH * POINTER_HEIGHT * sizeof(EG_PIXEL)));
|
||||||
newImage.CopyScaled(oldImage, 1.f);
|
// newImage.CopyScaled(oldImage, 1.f);
|
||||||
|
|
||||||
newImage.Compose(0, 0, PointerImage, true);
|
// newImage.Compose(0, 0, PointerImage, true);
|
||||||
newImage.Draw(newPlace.XPos, newPlace.YPos, 1.f);
|
// newImage.Draw(newPlace.XPos, newPlace.YPos, 1.f);
|
||||||
|
PointerImage.Draw(newPlace.XPos, newPlace.YPos, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID XPointer::KillMouse()
|
VOID XPointer::KillMouse()
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = CLOVER
|
BASE_NAME = CLOVERX64
|
||||||
FILE_GUID = 8F7D7B1E-0E1C-4C98-B12E-4EC99C4081AC
|
FILE_GUID = 8F7D7B1E-0E1C-4C98-B12E-4EC99C4081AC
|
||||||
MODULE_TYPE = UEFI_APPLICATION
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
EDK_RELEASE_VERSION = 0x00020000
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
@ -66,6 +66,8 @@
|
|||||||
entry_scan/securebootkeys.h
|
entry_scan/securebootkeys.h
|
||||||
gui/menu_items/menu_items.h
|
gui/menu_items/menu_items.h
|
||||||
gui/menu_items/menu_globals.h
|
gui/menu_items/menu_globals.h
|
||||||
|
# gui/REFIT_MENU_SCREEN.cpp
|
||||||
|
# gui/REFIT_MENU_SCREEN.h
|
||||||
libeg/egemb_icons.cpp
|
libeg/egemb_icons.cpp
|
||||||
libeg/egemb_icons_dark.cpp
|
libeg/egemb_icons_dark.cpp
|
||||||
libeg/egemb_font.cpp
|
libeg/egemb_font.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user