mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-17 01:11:36 +01:00
cleanup anime for xcinema
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
71562cf66a
commit
36b908900a
@ -98,12 +98,6 @@ CONST CHAR16 **RecoveryPlists = NULL;
|
||||
// QPI
|
||||
BOOLEAN SetTable132 = FALSE;
|
||||
|
||||
|
||||
#if XCINEMA
|
||||
// it is a part of Theme
|
||||
#else
|
||||
GUI_ANIME *GuiAnime = NULL;
|
||||
#endif
|
||||
//EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //define in lib.h
|
||||
const INTN BCSMargin = 11;
|
||||
BOOLEAN DayLight;
|
||||
@ -3467,11 +3461,6 @@ XTheme::GetThemeTagSettings (void* DictP)
|
||||
ScrollBarDecorationsHeight = 5;
|
||||
ScrollScrollDecorationsHeight = 7;
|
||||
Font = FONT_LOAD; //not default
|
||||
#if XCINEMA
|
||||
#else
|
||||
GuiAnime = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
// if NULL parameter, quit after setting default values, this is embedded theme
|
||||
if (DictP == NULL) {
|
||||
@ -3736,7 +3725,6 @@ XTheme::GetThemeTagSettings (void* DictP)
|
||||
Proportional = IsPropertyTrue (Dict2);
|
||||
}
|
||||
|
||||
#if XCINEMA
|
||||
Dict = GetProperty (DictPointer, "Anime");
|
||||
if (Dict != NULL) {
|
||||
INTN Count = GetTagCount (Dict);
|
||||
@ -3800,106 +3788,9 @@ XTheme::GetThemeTagSettings (void* DictP)
|
||||
NewFilm->GetFrames(ThemeX); //used properties: ID, Path, NumFrames
|
||||
ThemeX.Cinema.AddFilm(NewFilm);
|
||||
// delete NewFilm; //looks like already deleted
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#else
|
||||
Dict = GetProperty (DictPointer, "Anime");
|
||||
if (Dict != NULL) {
|
||||
INTN i, Count = GetTagCount (Dict);
|
||||
for (i = 0; i < Count; i++) {
|
||||
GUI_ANIME *Anime;
|
||||
if (EFI_ERROR (GetElement (Dict, i, &Dict3))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Dict3 == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
|
||||
if (Anime == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ID");
|
||||
Anime->ID = (UINTN)GetPropertyInteger (Dict2, 1); //default=main screen
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
Anime->Path = PoolPrint(L"%a", Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Frames");
|
||||
Anime->Frames = (UINTN)GetPropertyInteger (Dict2, Anime->Frames);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "FrameTime");
|
||||
Anime->FrameTime = (UINTN)GetPropertyInteger (Dict2, Anime->FrameTime);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeX");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "left") == 0) {
|
||||
Anime->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
|
||||
} else if (AsciiStrCmp (Dict2->string, "right") == 0) {
|
||||
Anime->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeY");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "top") == 0) {
|
||||
Anime->ScreenEdgeVertical = SCREEN_EDGE_TOP;
|
||||
} else if (AsciiStrCmp (Dict2->string, "bottom") == 0) {
|
||||
Anime->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
//default values are centre
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeX%");
|
||||
Anime->FilmX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeY%");
|
||||
Anime->FilmY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeX");
|
||||
Anime->NudgeX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeY");
|
||||
Anime->NudgeY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Once");
|
||||
Anime->Once = IsPropertyTrue (Dict2);
|
||||
|
||||
// Add the anime to the list
|
||||
if ((Anime->ID == 0) || (Anime->Path == NULL)) {
|
||||
FreePool (Anime);
|
||||
} else if (GuiAnime != NULL) { //second anime or further
|
||||
if (GuiAnime->ID == Anime->ID) { //why the same anime here?
|
||||
Anime->Next = GuiAnime->Next;
|
||||
FreeAnime (GuiAnime); //free double
|
||||
} else {
|
||||
GUI_ANIME *Ptr = GuiAnime;
|
||||
while (Ptr->Next) {
|
||||
if (Ptr->Next->ID == Anime->ID) { //delete double from list
|
||||
GUI_ANIME *Next = Ptr->Next;
|
||||
Ptr->Next = Next->Next;
|
||||
FreeAnime (Next);
|
||||
break;
|
||||
}
|
||||
Ptr = Ptr->Next;
|
||||
}
|
||||
Anime->Next = GuiAnime;
|
||||
}
|
||||
GuiAnime = Anime;
|
||||
} else {
|
||||
GuiAnime = Anime; //first anime
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//not sure if it needed
|
||||
if (BackgroundName.isEmpty()) {
|
||||
BackgroundName.takeValueFrom("background");
|
||||
@ -4036,25 +3927,10 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam, EFI_TIME *Time)
|
||||
mainParser = NULL;
|
||||
}
|
||||
*/
|
||||
//TODO switch to XImage
|
||||
// if (FontImage != NULL) {
|
||||
// DBG("free font image\n"); //raster font
|
||||
// egFreeImage (FontImage);
|
||||
// FontImage = NULL;
|
||||
// }
|
||||
ThemeX.FontImage.setEmpty();
|
||||
|
||||
Rnd = ((Time != NULL) && (ThemesNum != 0)) ? Time->Second % ThemesNum : 0;
|
||||
|
||||
//TODO remake GuiAnime
|
||||
#if !XCINEMA
|
||||
while (GuiAnime != NULL) {
|
||||
GUI_ANIME *NextAnime = GuiAnime->Next;
|
||||
// DBG("free anime %d\n", GuiAnime->ID);
|
||||
FreeAnime (GuiAnime);
|
||||
GuiAnime = NextAnime;
|
||||
}
|
||||
#endif
|
||||
// DBG("...done\n");
|
||||
ThemeX.GetThemeTagSettings(NULL);
|
||||
|
||||
|
@ -2137,12 +2137,9 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
|
||||
// DBG("next item in row1 at x=%d\n", row1PosXRunning);
|
||||
}
|
||||
}
|
||||
// initial painting
|
||||
// ThemeX.InitSelection(); //not here
|
||||
|
||||
// Update FilmPlace only if not set by InitAnime
|
||||
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
|
||||
// CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
|
||||
FilmPlace = ThemeX.BannerPlace;
|
||||
}
|
||||
|
||||
|
@ -86,20 +86,15 @@ public:
|
||||
XImage OldTextBufferImage;
|
||||
BOOLEAN isBootScreen;
|
||||
BOOLEAN AnimeRun;
|
||||
BOOLEAN Once;
|
||||
//BOOLEAN Once;
|
||||
//same for xcinema
|
||||
UINT64 LastDraw;
|
||||
INTN CurrentFrame;
|
||||
INTN Frames;
|
||||
UINTN FrameTime; //ms
|
||||
// INTN Frames; //there are FilmC properties
|
||||
// UINTN FrameTime; //ms
|
||||
EG_RECT FilmPlace;
|
||||
|
||||
#if XCINEMA
|
||||
FILM *FilmC;
|
||||
XImage FilmPlaceImage;
|
||||
#else
|
||||
EG_IMAGE **Film;
|
||||
#endif
|
||||
FILM *FilmC;
|
||||
//XImage FilmPlaceImage;
|
||||
|
||||
ACTION mAction;
|
||||
UINTN mItemID;
|
||||
@ -128,38 +123,24 @@ public:
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
#if XCINEMA
|
||||
FilmC(), FilmPlaceImage(),
|
||||
#else
|
||||
Film(0),
|
||||
#endif
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText)
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
#if XCINEMA
|
||||
FilmC(), FilmPlaceImage(),
|
||||
#else
|
||||
Film(0),
|
||||
#endif
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
//TODO exclude CHAR16
|
||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC)
|
||||
: ID(ID), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(), AnimeRun(0),
|
||||
Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
#if XCINEMA
|
||||
FilmC(), FilmPlaceImage(),
|
||||
#else
|
||||
Film(0),
|
||||
#endif
|
||||
LastDraw(0), CurrentFrame(0),
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{
|
||||
Title.takeValueFrom(TitleC);
|
||||
@ -170,13 +151,8 @@ public:
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
#if XCINEMA
|
||||
FilmC(), FilmPlaceImage(),
|
||||
#else
|
||||
Film(0),
|
||||
#endif
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{
|
||||
Entries.AddReference(entry1, false);
|
||||
@ -223,12 +199,7 @@ public:
|
||||
VOID CountItems();
|
||||
VOID InitAnime();
|
||||
VOID GetAnime(); //same for xcinema
|
||||
|
||||
#if XCINEMA
|
||||
VOID UpdateFilm(); // for future use instead of UpdateAnime
|
||||
#else
|
||||
VOID UpdateAnime();
|
||||
#endif
|
||||
VOID UpdateFilm();
|
||||
|
||||
//Style functions
|
||||
|
||||
|
@ -342,22 +342,76 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
//SelectionImages[i].Draw(i*100, 0);
|
||||
//}
|
||||
|
||||
#if XCINEMA
|
||||
//nothing to do?
|
||||
#else
|
||||
//banner animation
|
||||
GUI_ANIME *Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
|
||||
Anime->ID = 1; //main screen
|
||||
//there is no Anime->Path in vectors
|
||||
Anime->Frames = NumFrames;
|
||||
Anime->FrameTime = FrameTime;
|
||||
Anime->Next = GuiAnime;
|
||||
Anime->FilmX = INITVALUE;
|
||||
Anime->FilmY = INITVALUE;
|
||||
Anime->NudgeX = INITVALUE;
|
||||
Anime->NudgeY = INITVALUE;
|
||||
GuiAnime = Anime;
|
||||
#endif
|
||||
//TODO parse anime like for PNG themes
|
||||
/*
|
||||
Dict = GetProperty (DictPointer, "Anime");
|
||||
if (Dict != NULL) {
|
||||
INTN Count = GetTagCount (Dict);
|
||||
for (INTN i = 0; i < Count; i++) {
|
||||
FILM *NewFilm = new FILM();
|
||||
if (EFI_ERROR (GetElement (Dict, i, &Dict3))) {
|
||||
continue;
|
||||
}
|
||||
if (Dict3 == NULL) {
|
||||
break;
|
||||
}
|
||||
Dict2 = GetProperty (Dict3, "ID");
|
||||
NewFilm->SetIndex((UINTN)GetPropertyInteger (Dict2, 1)); //default=main screen
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
NewFilm->Path.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Frames");
|
||||
NewFilm->NumFrames = (UINTN)GetPropertyInteger (Dict2, 0);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "FrameTime");
|
||||
NewFilm->FrameTime = (UINTN)GetPropertyInteger (Dict2, 50); //default will be 50ms
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeX");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "left") == 0) {
|
||||
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
|
||||
} else if (AsciiStrCmp (Dict2->string, "right") == 0) {
|
||||
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeY");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "top") == 0) {
|
||||
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP;
|
||||
} else if (AsciiStrCmp (Dict2->string, "bottom") == 0) {
|
||||
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
//default values are centre
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeX%");
|
||||
NewFilm->FilmX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeY%");
|
||||
NewFilm->FilmY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeX");
|
||||
NewFilm->NudgeX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeY");
|
||||
NewFilm->NudgeY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Once");
|
||||
NewFilm->RunOnce = IsPropertyTrue (Dict2);
|
||||
|
||||
NewFilm->GetFrames(ThemeX); //used properties: ID, Path, NumFrames
|
||||
ThemeX.Cinema.AddFilm(NewFilm);
|
||||
// delete NewFilm; //looks like already deleted
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// nsvgDeleteRasterizer(rast);
|
||||
|
||||
TypeSVG = TRUE;
|
||||
@ -373,7 +427,6 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
return Status;
|
||||
}
|
||||
|
||||
#if XCINEMA
|
||||
EFI_STATUS XTheme::LoadSvgFrame(INTN i, OUT XImage* XFrame)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
@ -385,28 +438,7 @@ EFI_STATUS XTheme::LoadSvgFrame(INTN i, OUT XImage* XFrame)
|
||||
|
||||
return Status;
|
||||
}
|
||||
#else
|
||||
|
||||
EG_IMAGE * LoadSvgFrame(INTN i)
|
||||
{
|
||||
// EG_IMAGE *Frame = NULL;
|
||||
XImage XFrame;
|
||||
// NSVGparser *mainParser = (NSVGparser*)ThemeX.SVGParser;
|
||||
EFI_STATUS Status;
|
||||
// CHAR8 FrameName[64];
|
||||
XString XFrameName("frame_"_XS);
|
||||
//TODO if extend SVG syntax then we can use dynamic SVG with parameter Frame
|
||||
// for example use variable instead of constant like javascript
|
||||
XFrameName += SPrintf("%04lld", i+1); //I need exactly 4 symbols with leading zero
|
||||
// printf(FrameName, 63, "frame_%lld", i+1);
|
||||
|
||||
Status = ThemeX.ParseSVGXIcon(BUILTIN_ICON_ANIME, XFrameName, &XFrame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("icon '%s' not loaded, status=%s\n", XFrameName.c_str(), strerror(Status));
|
||||
}
|
||||
return XFrame.ToEGImage();
|
||||
}
|
||||
#endif
|
||||
// it is not draw, it is render and mainly used in egRenderText
|
||||
// which is used in icns.cpp as an icon replacement if no image found, looks like not used
|
||||
// in menu.cpp 3 places
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
// object XCinema Cinema is a part of Theme
|
||||
// object FILM* FilmC is a part or current Screen. Must be initialized from Cinema somewhere on Screen init
|
||||
#if XCINEMA
|
||||
|
||||
VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||
{
|
||||
if (FilmC == nullptr || !AnimeRun) {
|
||||
@ -62,7 +62,7 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||
}
|
||||
LastDraw = Now;
|
||||
}
|
||||
#endif
|
||||
|
||||
FILM* XCinema::GetFilm(INTN Id)
|
||||
{
|
||||
// DBG("ask film %lld from total of %lld\n", Id, Cinema.size());
|
||||
|
@ -119,9 +119,9 @@ public:
|
||||
XImage FontImage;
|
||||
|
||||
EG_RECT BannerPlace;
|
||||
#if XCINEMA
|
||||
|
||||
XCinema Cinema;
|
||||
#endif
|
||||
|
||||
void *SVGParser;
|
||||
//fill the theme
|
||||
// const XImage& GetIcon(const char* Name);
|
||||
|
@ -37,8 +37,6 @@
|
||||
#ifndef __LIBEG_LIBEG_H__
|
||||
#define __LIBEG_LIBEG_H__
|
||||
|
||||
#define XCINEMA 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -389,7 +387,7 @@ typedef struct {
|
||||
EG_PIXEL *PixelData;
|
||||
BOOLEAN HasAlpha; //moved here to avoid alignment issue
|
||||
} EG_IMAGE;
|
||||
|
||||
/*
|
||||
typedef struct GUI_ANIME GUI_ANIME;
|
||||
struct GUI_ANIME {
|
||||
UINTN ID;
|
||||
@ -403,7 +401,7 @@ struct GUI_ANIME {
|
||||
BOOLEAN Once;
|
||||
GUI_ANIME *Next;
|
||||
};
|
||||
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
class EG_RECT {
|
||||
public:
|
||||
|
@ -95,8 +95,11 @@
|
||||
#define NSVG_INLINE inline
|
||||
#endif
|
||||
|
||||
//TODO there are anime properties should be properties of FilmC
|
||||
//which is not accessible here
|
||||
UINTN NumFrames;
|
||||
UINTN FrameTime;
|
||||
|
||||
int nsvg__shapesBound(NSVGshape *shapes, float* bounds);
|
||||
void takeXformBounds(NSVGshape *shape, float *xform, float *bounds);
|
||||
void nsvg__deleteShapes(NSVGshape* shape);
|
||||
|
@ -1077,25 +1077,18 @@ EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefa
|
||||
if (Status != EFI_TIMEOUT) {
|
||||
break;
|
||||
}
|
||||
#if XCINEMA
|
||||
Screen.UpdateFilm();
|
||||
#else
|
||||
Screen.UpdateAnime();
|
||||
#endif
|
||||
if (gSettings.PlayAsync) {
|
||||
CheckSyncSound();
|
||||
}
|
||||
TimeoutRemain--;
|
||||
// if ( Screen.mPointer ) {
|
||||
if (Screen.mPointer.isAlive()) {
|
||||
Screen.mPointer.UpdatePointer();
|
||||
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
|
||||
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (Screen.mPointer.isAlive()) {
|
||||
Screen.mPointer.UpdatePointer();
|
||||
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
|
||||
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
@ -321,21 +321,7 @@ typedef struct {
|
||||
#define SCREEN_EDGE_TOP 60000
|
||||
#define SCREEN_EDGE_RIGHT 70000
|
||||
#define SCREEN_EDGE_BOTTOM 80000
|
||||
/*
|
||||
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;
|
||||
};
|
||||
*/
|
||||
|
||||
extern EFI_HANDLE SelfImageHandle;
|
||||
extern EFI_HANDLE SelfDeviceHandle;
|
||||
extern EFI_LOADED_IMAGE *SelfLoadedImage;
|
||||
@ -349,12 +335,6 @@ extern EFI_FILE *OEMDir;
|
||||
extern CHAR16 *OEMPath;
|
||||
extern EFI_FILE *OemThemeDir;
|
||||
|
||||
//extern BOOLEAN MainAnime;
|
||||
#if XCINEMA
|
||||
#else
|
||||
extern GUI_ANIME *GuiAnime;
|
||||
#endif
|
||||
|
||||
extern REFIT_VOLUME *SelfVolume;
|
||||
#ifdef __cplusplus
|
||||
extern XObjArray<REFIT_VOLUME> Volumes;
|
||||
|
@ -79,9 +79,6 @@ EG_IMAGE * LoadSvgFrame(INTN i);
|
||||
INTN UGAWidth;
|
||||
INTN UGAHeight;
|
||||
BOOLEAN AllowGraphicsMode;
|
||||
#if !XCINEMA
|
||||
EG_RECT BannerPlace; // default ctor called, so it's zero
|
||||
#endif
|
||||
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff};
|
||||
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00};
|
||||
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL InputBackgroundPixel = { 0xcf, 0xcf, 0xcf, 0x80};
|
||||
@ -411,18 +408,6 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *
|
||||
|
||||
#define MAX_SIZE_ANIME 256
|
||||
|
||||
VOID FreeAnime(GUI_ANIME *Anime)
|
||||
{
|
||||
if (Anime) {
|
||||
if (Anime->Path) {
|
||||
FreePool(Anime->Path);
|
||||
Anime->Path = NULL;
|
||||
}
|
||||
FreePool(Anime);
|
||||
// Anime = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static INTN ConvertEdgeAndPercentageToPixelPosition(INTN Edge, INTN DesiredPercentageFromEdge, INTN ImageDimension, INTN ScreenDimension)
|
||||
{
|
||||
if (Edge == SCREEN_EDGE_LEFT || Edge == SCREEN_EDGE_TOP) {
|
||||
@ -479,7 +464,7 @@ INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN Screen
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
#if XCINEMA
|
||||
|
||||
void REFIT_MENU_SCREEN::GetAnime()
|
||||
{
|
||||
FilmC = ThemeX.Cinema.GetFilm(ID);
|
||||
@ -529,10 +514,6 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
||||
} else {
|
||||
// We are here if there is no anime, or if we use oldstyle placement values
|
||||
// For both these cases, FilmPlace will be set after banner/menutitle positions are known
|
||||
// FilmC->FilmPlace.XPos = 0;
|
||||
// FilmC->FilmPlace.YPos = 0;
|
||||
// FilmC->FilmPlace.Width = 0;
|
||||
// FilmC->FilmPlace.Height = 0;
|
||||
FilmC->FilmPlace = ThemeX.BannerPlace;
|
||||
}
|
||||
if (FilmC->NumFrames != 0) {
|
||||
@ -542,206 +523,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
||||
LastDraw = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
static EG_IMAGE *AnimeImage = NULL;
|
||||
|
||||
VOID REFIT_MENU_SCREEN::UpdateAnime()
|
||||
{
|
||||
UINT64 Now;
|
||||
INTN x, y;
|
||||
|
||||
//INTN LayoutAnimMoveForMenuX = 0;
|
||||
INTN MenuWidth = 50;
|
||||
|
||||
if (!AnimeRun || !Film || GlobalConfig.TextOnly) return;
|
||||
if (!AnimeImage ||
|
||||
(AnimeImage->Width != Film[0]->Width) ||
|
||||
(AnimeImage->Height != Film[0]->Height)){
|
||||
if (AnimeImage) {
|
||||
egFreeImage(AnimeImage);
|
||||
}
|
||||
// DBG("create new AnimeImage [%d,%d]\n", Film[0]->Width, Film[0]->Height);
|
||||
AnimeImage = egCreateImage(Film[0]->Width, Film[0]->Height, TRUE);
|
||||
}
|
||||
// DBG("anime rect pos=[%d,%d] size=[%d,%d]\n", Place->XPos, Place->YPos,
|
||||
// Place->Width, Place->Height);
|
||||
// DBG("anime size=[%d,%d]\n", AnimeImage->Width, AnimeImage->Height);
|
||||
|
||||
// Retained for legacy themes without new anim placement options.
|
||||
x = FilmPlace.XPos + (FilmPlace.Width - AnimeImage->Width) / 2;
|
||||
y = FilmPlace.YPos + (FilmPlace.Height - AnimeImage->Height) / 2;
|
||||
|
||||
if (!IsImageWithinScreenLimits(x, Film[0]->Width, UGAWidth) || !IsImageWithinScreenLimits(y, Film[0]->Height, UGAHeight)) {
|
||||
// DBG(") This anime can't be displayed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the theme.plist setting for allowing an anim to be moved horizontally in the quest
|
||||
// to avoid overlapping the menu text on menu pages at lower resolutions is set.
|
||||
if ((ID > 1) && (ThemeX.LayoutAnimMoveForMenuX != 0)) { // these screens have text menus which the anim may interfere with.
|
||||
MenuWidth = (INTN)(TEXT_XMARGIN * 2 + (50 * ThemeX.CharWidth * ThemeX.Scale)); // taken from menu.c
|
||||
if ((x + Film[0]->Width) > (UGAWidth - MenuWidth) >> 1) {
|
||||
if ((x + ThemeX.LayoutAnimMoveForMenuX >= 0) || (UGAWidth-(x + ThemeX.LayoutAnimMoveForMenuX + Film[0]->Width)) <= 100) {
|
||||
x += ThemeX.LayoutAnimMoveForMenuX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Now = AsmReadTsc();
|
||||
if (LastDraw == 0) {
|
||||
//first start, we should save background into last frame
|
||||
egFillImageArea(AnimeImage, 0, 0, AnimeImage->Width, AnimeImage->Height, (EG_PIXEL*)&MenuBackgroundPixel);
|
||||
egTakeImage(Film[Frames],
|
||||
x, y,
|
||||
Film[Frames]->Width,
|
||||
Film[Frames]->Height);
|
||||
}
|
||||
if (TimeDiff(LastDraw, Now) < FrameTime) return;
|
||||
if (Film[CurrentFrame]) {
|
||||
egRawCopy(AnimeImage->PixelData, Film[Frames]->PixelData,
|
||||
Film[Frames]->Width,
|
||||
Film[Frames]->Height,
|
||||
AnimeImage->Width,
|
||||
Film[Frames]->Width);
|
||||
AnimeImage->HasAlpha = FALSE;
|
||||
egComposeImage(AnimeImage, Film[CurrentFrame], 0, 0); //aaaa
|
||||
BltImage(AnimeImage, x, y);
|
||||
}
|
||||
CurrentFrame++;
|
||||
if (CurrentFrame >= Frames) {
|
||||
AnimeRun = !Once;
|
||||
CurrentFrame = 0;
|
||||
}
|
||||
LastDraw = Now;
|
||||
}
|
||||
//by initial we use EG_IMAGE anime
|
||||
//TODO will be rewritten by XCinema class
|
||||
VOID REFIT_MENU_SCREEN::InitAnime()
|
||||
{
|
||||
CHAR16 FileName[256];
|
||||
CHAR16 *Path;
|
||||
EG_IMAGE *p = NULL;
|
||||
EG_IMAGE *Last = NULL;
|
||||
GUI_ANIME *Anime;
|
||||
|
||||
if (GlobalConfig.TextOnly) return;
|
||||
//
|
||||
for (Anime = GuiAnime; Anime != NULL && Anime->ID != ID; Anime = Anime->Next);
|
||||
|
||||
// Check if we should clear old film vars (no anime or anime path changed)
|
||||
//
|
||||
if (gThemeOptionsChanged || !Anime || !Film || IsEmbeddedTheme() ||
|
||||
gThemeChanged) {
|
||||
// DBG(" free screen\n");
|
||||
if (Film) {
|
||||
//free images in the film
|
||||
for (INTN i = 0; i <= Frames; i++) { //really there are N+1 frames
|
||||
// free only last occurrence of repeated frames
|
||||
if (Film[i] != NULL && (i == Frames || Film[i] != Film[i+1])) {
|
||||
FreePool(Film[i]);
|
||||
}
|
||||
}
|
||||
FreePool(Film);
|
||||
Film = NULL;
|
||||
Frames = 0;
|
||||
}
|
||||
}
|
||||
// Check if we should load anime files (first run or after theme change)
|
||||
if (Anime && Film == NULL) {
|
||||
Path = Anime->Path;
|
||||
Film = (EG_IMAGE**)AllocateZeroPool((Anime->Frames + 1) * sizeof(VOID*));
|
||||
if ((ThemeX.TypeSVG || Path) && Film) {
|
||||
// Look through contents of the directory
|
||||
UINTN i;
|
||||
for (i = 0; i < Anime->Frames; i++) {
|
||||
// DBG("Try to load file %ls\n", FileName);
|
||||
if (ThemeX.TypeSVG) {
|
||||
p = LoadSvgFrame(i);
|
||||
// DBG("frame %d loaded\n", i);
|
||||
} else {
|
||||
snwprintf(FileName, 512, "%ls\\%ls_%03llu.png", Path, Path, i);
|
||||
p = egLoadImage(ThemeX.ThemeDir, FileName, TRUE);
|
||||
}
|
||||
if (!p) {
|
||||
p = Last;
|
||||
if (!p) break;
|
||||
} else {
|
||||
Last = p;
|
||||
}
|
||||
Film[i] = p;
|
||||
}
|
||||
if (Film[0] != NULL) {
|
||||
Frames = i;
|
||||
DBG(" found %llu frames of the anime\n", i);
|
||||
// Create background frame
|
||||
Film[i] = egCreateImage(Film[0]->Width, Film[0]->Height, FALSE);
|
||||
// Copy some settings from Anime into Screen
|
||||
FrameTime = Anime->FrameTime;
|
||||
Once = Anime->Once;
|
||||
// Theme = (__typeof__(Theme))AllocateCopyPool(StrSize(GlobalConfig.Theme), GlobalConfig.Theme);
|
||||
} /*else {
|
||||
DBG("Film[0] == NULL\n");
|
||||
} */
|
||||
}
|
||||
}
|
||||
// Check if a new style placement value has been specified
|
||||
if (Anime && (Anime->FilmX >=0) && (Anime->FilmX <=100) &&
|
||||
(Anime->FilmY >=0) && (Anime->FilmY <=100) &&
|
||||
(Film != NULL) && (Film[0] != NULL)) {
|
||||
// Check if screen size being used is different from theme origination size.
|
||||
// If yes, then recalculate the animation placement % value.
|
||||
// This is necessary because screen can be a different size, but anim is not scaled.
|
||||
FilmPlace.XPos = HybridRepositioning(Anime->ScreenEdgeHorizontal, Anime->FilmX, Film[0]->Width, UGAWidth, ThemeX.ThemeDesignWidth );
|
||||
FilmPlace.YPos = HybridRepositioning(Anime->ScreenEdgeVertical, Anime->FilmY, Film[0]->Height, UGAHeight, ThemeX.ThemeDesignHeight);
|
||||
|
||||
// Does the user want to fine tune the placement?
|
||||
FilmPlace.XPos = CalculateNudgePosition(FilmPlace.XPos, Anime->NudgeX, Film[0]->Width, UGAWidth);
|
||||
FilmPlace.YPos = CalculateNudgePosition(FilmPlace.YPos, Anime->NudgeY, Film[0]->Height, UGAHeight);
|
||||
|
||||
FilmPlace.Width = Film[0]->Width;
|
||||
FilmPlace.Height = Film[0]->Height;
|
||||
DBG("recalculated Film position\n");
|
||||
} else {
|
||||
// We are here if there is no anime, or if we use oldstyle placement values
|
||||
// For both these cases, FilmPlace will be set after banner/menutitle positions are known
|
||||
FilmPlace.XPos = 0;
|
||||
FilmPlace.YPos = 0;
|
||||
FilmPlace.Width = 0;
|
||||
FilmPlace.Height = 0;
|
||||
}
|
||||
if (Film != NULL && Film[0] != NULL) {
|
||||
DBG(" Anime seems OK, init it\n");
|
||||
AnimeRun = TRUE;
|
||||
CurrentFrame = 0;
|
||||
LastDraw = 0;
|
||||
} else {
|
||||
// DBG("not run anime\n");
|
||||
AnimeRun = FALSE;
|
||||
}
|
||||
// DBG("anime inited\n");
|
||||
}
|
||||
|
||||
VOID REFIT_MENU_SCREEN::GetAnime()
|
||||
{
|
||||
GUI_ANIME *Anime;
|
||||
|
||||
if (!GuiAnime) {
|
||||
AnimeRun = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (Anime = GuiAnime; Anime != NULL && Anime->ID != ID; Anime = Anime->Next);
|
||||
if (Anime == NULL || Anime->Path == NULL) {
|
||||
AnimeRun = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
DBG("Use anime=%ls frames=%llu\n", Anime->Path, Anime->Frames);
|
||||
AnimeRun = TRUE;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// Sets next/previous available screen resolution, according to specified offset
|
||||
//
|
||||
|
@ -9,13 +9,6 @@ VOID FinishExternalScreen(VOID);
|
||||
VOID TerminateScreen(VOID);
|
||||
VOID SetNextScreenMode(INT32);
|
||||
|
||||
|
||||
//VOID GetAnime(REFIT_MENU_SCREEN *Screen);
|
||||
//VOID InitAnime(REFIT_MENU_SCREEN *Screen);
|
||||
//VOID UpdateAnime(REFIT_MENU_SCREEN *Screen, const EG_RECT *Place);
|
||||
VOID FreeAnime(GUI_ANIME *Anime);
|
||||
|
||||
|
||||
VOID SwitchToGraphicsAndClear(VOID);
|
||||
VOID BltClearScreen();
|
||||
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
|
||||
|
Loading…
Reference in New Issue
Block a user