Make Id protected in XCinema

This commit is contained in:
jief 2020-04-14 22:37:44 +03:00
parent a9f3874779
commit e471eb744a
7 changed files with 36 additions and 12 deletions

View File

@ -23,6 +23,14 @@
9A09863C2438A15400826276 /* shared_with_menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A0986362438A15400826276 /* shared_with_menu.h */; };
9A09863D2438A15400826276 /* shared_with_menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A0986362438A15400826276 /* shared_with_menu.h */; };
9A09863E2438A15400826276 /* shared_with_menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A0986362438A15400826276 /* shared_with_menu.h */; };
9A105B1A244644C50006DE06 /* XCinema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B18244644C50006DE06 /* XCinema.cpp */; };
9A105B1B244644C50006DE06 /* XCinema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B18244644C50006DE06 /* XCinema.cpp */; };
9A105B1C244644C50006DE06 /* XCinema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B18244644C50006DE06 /* XCinema.cpp */; };
9A105B1D244644C50006DE06 /* XCinema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B18244644C50006DE06 /* XCinema.cpp */; };
9A105B1E244644C50006DE06 /* XCinema.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A105B19244644C50006DE06 /* XCinema.h */; };
9A105B1F244644C50006DE06 /* XCinema.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A105B19244644C50006DE06 /* XCinema.h */; };
9A105B20244644C50006DE06 /* XCinema.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A105B19244644C50006DE06 /* XCinema.h */; };
9A105B21244644C50006DE06 /* XCinema.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A105B19244644C50006DE06 /* XCinema.h */; };
9A28CC93241AB33700F3D247 /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC91241AB33700F3D247 /* XString.cpp */; };
9A28CC94241AB33700F3D247 /* XString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC92241AB33700F3D247 /* XString.h */; };
9A28CC97241AB34800F3D247 /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC95241AB34800F3D247 /* XString_test.cpp */; };
@ -840,6 +848,8 @@
9A09863024389A6A00826276 /* menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menu.cpp; sourceTree = "<group>"; };
9A0986352438A15400826276 /* shared_with_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shared_with_menu.cpp; sourceTree = "<group>"; };
9A0986362438A15400826276 /* shared_with_menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_with_menu.h; sourceTree = "<group>"; };
9A105B18244644C50006DE06 /* XCinema.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XCinema.cpp; sourceTree = "<group>"; };
9A105B19244644C50006DE06 /* XCinema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCinema.h; sourceTree = "<group>"; };
9A28CC91241AB33700F3D247 /* XString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString.cpp; sourceTree = "<group>"; };
9A28CC92241AB33700F3D247 /* XString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString.h; sourceTree = "<group>"; };
9A28CC95241AB34800F3D247 /* XString_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString_test.cpp; sourceTree = "<group>"; };
@ -1280,6 +1290,8 @@
9AC77F5C24176C04005CDD5C /* libeg */ = {
isa = PBXGroup;
children = (
9A105B18244644C50006DE06 /* XCinema.cpp */,
9A105B19244644C50006DE06 /* XCinema.h */,
9AC77F5F24176C04005CDD5C /* BmLib.cpp */,
9AC77F6B24176C04005CDD5C /* EfiFileLib.h */,
9AC77F6A24176C04005CDD5C /* egemb_font.cpp */,
@ -1427,6 +1439,7 @@
files = (
9AC7808B24176C04005CDD5C /* panic.h in Headers */,
9AC7806B24176C04005CDD5C /* MSKEK.h in Headers */,
9A105B1E244644C50006DE06 /* XCinema.h in Headers */,
9AC7807224176C04005CDD5C /* menu_items.h in Headers */,
A5E326322428F4EE002240E8 /* XTheme.h in Headers */,
9AC7801C24176C04005CDD5C /* nvidia.h in Headers */,
@ -1574,6 +1587,7 @@
9ACFE67924309AF80071CC93 /* screen.h in Headers */,
9ACFE67A24309AF80071CC93 /* printlib-test.h in Headers */,
9ACFE67B24309AF80071CC93 /* DataHubCpu.h in Headers */,
9A105B21244644C50006DE06 /* XCinema.h in Headers */,
9ACFE67C24309AF80071CC93 /* lib.h in Headers */,
9ACFE67D24309AF80071CC93 /* b64cdecode.h in Headers */,
9ACFE67E24309AF80071CC93 /* EfiFileLib.h in Headers */,
@ -1723,6 +1737,7 @@
9AF415DC242CD75C00D2644C /* sse3_patcher.h in Headers */,
9AF415DD242CD75C00D2644C /* Version.h in Headers */,
9AF415DE242CD75C00D2644C /* XString_test.h in Headers */,
9A105B1F244644C50006DE06 /* XCinema.h in Headers */,
9AF415DF242CD75C00D2644C /* stdint.h in Headers */,
9AF415E0242CD75C00D2644C /* REFIT_MENU_SCREEN.h in Headers */,
9AF415E1242CD75C00D2644C /* Platform.h in Headers */,
@ -1826,6 +1841,7 @@
9AF416B9242CDA5800D2644C /* sse3_patcher.h in Headers */,
9AF416BA242CDA5800D2644C /* Version.h in Headers */,
9AF416BB242CDA5800D2644C /* XString_test.h in Headers */,
9A105B20244644C50006DE06 /* XCinema.h in Headers */,
9AF416BC242CDA5800D2644C /* stdint.h in Headers */,
9AF416BD242CDA5800D2644C /* REFIT_MENU_SCREEN.h in Headers */,
9AF416BE242CDA5800D2644C /* Platform.h in Headers */,
@ -2037,6 +2053,7 @@
9AC7802324176C04005CDD5C /* BootOptions.cpp in Sources */,
9A9D3B2D242215A1006D8CD9 /* stdio.cpp in Sources */,
9AC7808924176C04005CDD5C /* operatorNewDelete.cpp in Sources */,
9A105B1A244644C50006DE06 /* XCinema.cpp in Sources */,
9AC7807124176C04005CDD5C /* securehash.cpp in Sources */,
9AC7804B24176C04005CDD5C /* image.cpp in Sources */,
9AC7803624176C04005CDD5C /* Events.cpp in Sources */,
@ -2153,6 +2170,7 @@
9ACFE6BF24309AF80071CC93 /* BootOptions.cpp in Sources */,
9ACFE6C024309AF80071CC93 /* stdio.cpp in Sources */,
9ACFE6C124309AF80071CC93 /* operatorNewDelete.cpp in Sources */,
9A105B1D244644C50006DE06 /* XCinema.cpp in Sources */,
9ACFE6C224309AF80071CC93 /* securehash.cpp in Sources */,
9ACFE6C324309AF80071CC93 /* image.cpp in Sources */,
9ACFE6C424309AF80071CC93 /* Events.cpp in Sources */,
@ -2269,6 +2287,7 @@
9AF415F5242CD75C00D2644C /* BootOptions.cpp in Sources */,
9AF415F6242CD75C00D2644C /* stdio.cpp in Sources */,
9AF415F7242CD75C00D2644C /* operatorNewDelete.cpp in Sources */,
9A105B1B244644C50006DE06 /* XCinema.cpp in Sources */,
9AF415F8242CD75C00D2644C /* securehash.cpp in Sources */,
9AF415F9242CD75C00D2644C /* image.cpp in Sources */,
9AF415FA242CD75C00D2644C /* Events.cpp in Sources */,
@ -2385,6 +2404,7 @@
9AF416D2242CDA5800D2644C /* BootOptions.cpp in Sources */,
9AF416D3242CDA5800D2644C /* stdio.cpp in Sources */,
9AF416D4242CDA5800D2644C /* operatorNewDelete.cpp in Sources */,
9A105B1C244644C50006DE06 /* XCinema.cpp in Sources */,
9AF416D5242CDA5800D2644C /* securehash.cpp in Sources */,
9AF416D6242CDA5800D2644C /* image.cpp in Sources */,
9AF416D7242CDA5800D2644C /* Events.cpp in Sources */,

View File

@ -3750,7 +3750,7 @@ XTheme::GetThemeTagSettings (void* DictP)
break;
}
Dict2 = GetProperty (Dict3, "ID");
NewFilm->Id = (UINTN)GetPropertyInteger (Dict2, 1); //default=main screen
NewFilm->SetIndex((UINTN)GetPropertyInteger (Dict2, 1)); //default=main screen
Dict2 = GetProperty (Dict3, "Path");
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {

View File

@ -297,7 +297,7 @@ int printf_lite_tests(void)
Test1arg(F("|0A|"), F("|%02X|"), (uint8_t)0xa);
#define SMST(a) ((UINT8)((a & 0xf0) >> 4))
#define SLST(a) ((UINT8)(a & 0x0f))
testPrintf("spd", "00000F0F04070408", strlen("00000F0F04070408"), "%02X%02X%02X%02X%02X%02X%02X%02X", SMST(0x00) , SLST(0x00), SMST(0xFF), SLST(0xFF), SMST(0x147), SLST(0x147), SMST(0x148), SLST(0x148));
testPrintf("spd", "00000F0F04070408", (int)strlen("00000F0F04070408"), "%02X%02X%02X%02X%02X%02X%02X%02X", SMST(0x00) , SLST(0x00), SMST(0xFF), SLST(0xFF), SMST(0x147), SLST(0x147), SMST(0x148), SLST(0x148));
Test1arg(F("|0A23|"), F("|%04X|"), 0xa23);

View File

@ -251,7 +251,7 @@ int printlib_tests(void)
Test1arg(F("|0A|"), F("|%2X|"), (uint8_t)0xa);
#define SMST(a) ((UINT8)((a & 0xf0) >> 4))
#define SLST(a) ((UINT8)(a & 0x0f))
testPrintf("spd", "00000F0F04070408", strlen("00000F0F04070408"), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(0x00) , SLST(0x00), SMST(0xFF), SLST(0xFF), SMST(0x147), SLST(0x147), SMST(0x148), SLST(0x148));
testPrintf("spd", "00000F0F04070408", (int)strlen("00000F0F04070408"), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(0x00) , SLST(0x00), SMST(0xFF), SLST(0xFF), SMST(0x147), SLST(0x147), SMST(0x148), SLST(0x148));
Test1arg(F("|12345|"), F("|%2X|"), 0x12345);
Test1arg(F("|12345|"), F("|%4X|"), 0x12345);

View File

@ -52,7 +52,7 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
FILM* XCinema::GetFilm(INTN Id)
{
for (size_t i = 0; i < Cinema.size(); ++i) {
if (Cinema[i].Id == Id) {
if (Cinema[i].GetIndex() == Id) {
return &Cinema[i];
}
}
@ -68,7 +68,7 @@ static XImage NullImage;
const XImage& FILM::GetImage(INTN Index) const
{
for (size_t i = 0; i < Frames.size(); ++i) {
if (Frames[i].Id == Index) {
if (Frames[i].getIndex() == Index) {
return Frames[i].getImage();
}
}
@ -78,7 +78,7 @@ const XImage& FILM::GetImage(INTN Index) const
const XImage& FILM::GetImage() const
{
for (size_t i = 0; i < Frames.size(); ++i) {
if (Frames[i].Id == CurrentFrame) {
if (Frames[i].getIndex() == CurrentFrame) {
return Frames[i].getImage();
}
}
@ -96,7 +96,7 @@ void FILM::AddFrame(XImage* Frame, INTN Index)
}
}
void FILM::GetFrames(XTheme& TheTheme, const XStringW& Path)
void FILM::GetFrames(XTheme& TheTheme /*, const XStringW& Path*/) // Path already exist as a member. Is it the same ?
{
EFI_FILE *ThemeDir = TheTheme.ThemeDir;
EFI_STATUS Status;

View File

@ -23,10 +23,11 @@ class XTheme;
class FILM
{
protected:
INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility
public:
//I see no reason to make they protected
bool RunOnce;
INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility
INTN NumFrames; //set by user in Theme.plist or in Theme.svg
INTN FrameTime; //usually 50, 100, 200 ms
INTN FilmX, FilmY; //relative
@ -45,17 +46,20 @@ public:
public:
FILM() {}
FILM(INTN Id) : RunOnce(false), Id(Id)
FILM(INTN Id) : Id(Id), RunOnce(false)
{}
~FILM() {}
INTN GetIndex() { return Id; }
void SetIndex(INTN Index) { Id = Index; }
const XImage& GetImage(INTN Index) const;
const XImage& GetImage() const;
void AddFrame(XImage* Frame, INTN Index); //IndexedImage will be created
size_t Size() { return Frames.size(); }
INTN LastFrameID() { return LastIndex; }
bool Finished() { return CurrentFrame == 0; }
void GetFrames(XTheme& TheTheme, const XStringW& Path); //read image sequence from Theme/Path/
void GetFrames(XTheme& TheTheme/*, const XStringW& Path*/); //read image sequence from Theme/Path/
void SetPlace(const EG_RECT& Rect) { FilmPlace = Rect; }
void Advance() { ++CurrentFrame %= (LastIndex + 1); }
void Reset() { CurrentFrame = 0; }

View File

@ -119,12 +119,12 @@ protected:
class IndexedImage
{
public:
INTN Id;
protected:
INTN Id;
XImage Image;
public:
INTN getIndex() { return Id; }
INTN getIndex() const { return Id; }
void setIndex(INTN Index) { Id = Index; }
const XImage& getImage() const { return Image; }
void setImage(const XImage& Sample) { Image = Sample; }