mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-26 12:05:36 +01:00
repair vector themes
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
f3bf23c79e
commit
92ecdbf630
@ -105,7 +105,6 @@
|
||||
A57CF7D7241BE111006DE51E /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57CF7D6241BE111006DE51E /* XString_test.cpp */; };
|
||||
A5816DED24180F4D003BA66C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5816DEC24180F4C003BA66C /* panic.cpp */; };
|
||||
A5816DF024180F82003BA66C /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5816DEE24180F81003BA66C /* global_test.cpp */; };
|
||||
A5816DF22418101C003BA66C /* XStringWP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5816DF12418101C003BA66C /* XStringWP.cpp */; };
|
||||
A5816DF62418103A003BA66C /* menu_items.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5816DF52418103A003BA66C /* menu_items.cpp */; };
|
||||
A5816DF924181050003BA66C /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5816DF72418104F003BA66C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
A59CB66921BC14AB0054A7CF /* SmbiosGen.c in Sources */ = {isa = PBXBuildFile; fileRef = A59CB66521BC14AA0054A7CF /* SmbiosGen.c */; };
|
||||
@ -2488,8 +2487,6 @@
|
||||
A571C2712405749900B6A2C5 /* XStringW.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringW.h; sourceTree = "<group>"; };
|
||||
A571C2722405749900B6A2C5 /* XStringWArray.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWArray.cpp; sourceTree = "<group>"; };
|
||||
A571C2732405749900B6A2C5 /* XStringW.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW.cpp; sourceTree = "<group>"; };
|
||||
A571C2742405749900B6A2C5 /* utf8Conversion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = utf8Conversion.cpp; sourceTree = "<group>"; };
|
||||
A571C2752405749900B6A2C5 /* utf8Conversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utf8Conversion.h; sourceTree = "<group>"; };
|
||||
A571C2772405749900B6A2C5 /* XToolsCommon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon.cpp; sourceTree = "<group>"; };
|
||||
A571C2792405749900B6A2C5 /* XArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = "<group>"; };
|
||||
A571C27A2405749900B6A2C5 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; };
|
||||
@ -2530,7 +2527,6 @@
|
||||
A5816DEC24180F4C003BA66C /* panic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = panic.cpp; sourceTree = "<group>"; };
|
||||
A5816DEE24180F81003BA66C /* global_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global_test.cpp; sourceTree = "<group>"; };
|
||||
A5816DEF24180F82003BA66C /* global_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = global_test.h; sourceTree = "<group>"; };
|
||||
A5816DF12418101C003BA66C /* XStringWP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWP.cpp; sourceTree = "<group>"; };
|
||||
A5816DF52418103A003BA66C /* menu_items.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menu_items.cpp; sourceTree = "<group>"; };
|
||||
A5816DF72418104F003BA66C /* REFIT_MENU_SCREEN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = REFIT_MENU_SCREEN.cpp; sourceTree = "<group>"; };
|
||||
A5816DF82418104F003BA66C /* REFIT_MENU_SCREEN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REFIT_MENU_SCREEN.h; sourceTree = "<group>"; };
|
||||
@ -5970,7 +5966,6 @@
|
||||
A5D12C30243A0B9100DFA98A /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
|
||||
A5D12C32243A0BD900DFA98A /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
A5D12C33243A0BD900DFA98A /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
A5D12C35243A0BE500DFA98A /* XStringWP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringWP.h; sourceTree = "<group>"; };
|
||||
A5D12C36243A0C2300DFA98A /* VectorGraphics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VectorGraphics.h; sourceTree = "<group>"; };
|
||||
A5D12C37243A0C4D00DFA98A /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
|
||||
A5D12C39243A0C9D00DFA98A /* stdio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = stdio.cpp; sourceTree = "<group>"; };
|
||||
@ -8285,8 +8280,6 @@
|
||||
A571C26E2405749900B6A2C5 /* cpp_foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A571C2742405749900B6A2C5 /* utf8Conversion.cpp */,
|
||||
A571C2752405749900B6A2C5 /* utf8Conversion.h */,
|
||||
A571C2792405749900B6A2C5 /* XArray.h */,
|
||||
A571C27A2405749900B6A2C5 /* XObjArray.h */,
|
||||
A57CF7C9241BE0D6006DE51E /* XString.cpp */,
|
||||
@ -8297,8 +8290,6 @@
|
||||
A571C2712405749900B6A2C5 /* XStringW.h */,
|
||||
A571C2722405749900B6A2C5 /* XStringWArray.cpp */,
|
||||
A571C26F2405749900B6A2C5 /* XStringWArray.h */,
|
||||
A5816DF12418101C003BA66C /* XStringWP.cpp */,
|
||||
A5D12C35243A0BE500DFA98A /* XStringWP.h */,
|
||||
A571C2772405749900B6A2C5 /* XToolsCommon.cpp */,
|
||||
A571C2702405749900B6A2C5 /* XToolsCommon.h */,
|
||||
);
|
||||
@ -17408,7 +17399,6 @@
|
||||
A5456D5E23FC5B08000BF18C /* smbios.cpp in Sources */,
|
||||
A5AAFC35237F13B3009CD413 /* TerminalConIn.c in Sources */,
|
||||
A5AAFBDA237F13B3009CD413 /* SmbiosMeasurementDxe.c in Sources */,
|
||||
A5816DF22418101C003BA66C /* XStringWP.cpp in Sources */,
|
||||
A5AAFD6D237F13B4009CD413 /* CapsuleDump.c in Sources */,
|
||||
A5AAFBB4237F13B3009CD413 /* unicode_unfold_key.c in Sources */,
|
||||
A5AA0581237F13C1009CD413 /* Monitor.nasm in Sources */,
|
||||
|
@ -354,7 +354,7 @@ STATIC XString LinuxKernelOptions(IN EFI_FILE_PROTOCOL *Dir,
|
||||
}
|
||||
while (Index < LinuxInitImagePathCount) {
|
||||
XStringW InitRd = SWPrintf(LinuxInitImagePath[Index++].c_str(), (Version == NULL) ? L"" : Version);
|
||||
if (InitRd != NULL) {
|
||||
if (InitRd.notEmpty()) {
|
||||
if (FileExists(Dir, InitRd.wc_str())) {
|
||||
XString CustomOptions = SPrintf("root=/dev/disk/by-partuuid/%ls initrd=%ls\\%ls %s %s", PartUUID, LINUX_BOOT_ALT_PATH, InitRd.wc_str(), LINUX_DEFAULT_OPTIONS.c_str(), Options.c_str());
|
||||
return CustomOptions;
|
||||
|
@ -66,7 +66,7 @@ textFaces textFace[4]; //0-help 1-message 2-menu 3-test, far future it wil
|
||||
NSVGparser *mainParser = NULL; //it must be global variable
|
||||
|
||||
#if USE_XTHEME
|
||||
EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX, float iconScale, XImage* Image) // scale renamed iconScale to not hide member var Scale
|
||||
EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX, XImage* Image)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
NSVGimage *SVGimage;
|
||||
@ -77,7 +77,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
NSVGgroup *group;
|
||||
NSVGimage *IconImage;
|
||||
NSVGshape *shapeNext, *shapesTail = NULL, *shapePrev;
|
||||
CONST CHAR8 *IconName = IconNameX.c_str();
|
||||
// CONST CHAR8 *IconName = IconNameX.c_str();
|
||||
|
||||
NSVGparser* p2 = nsvg__createParser();
|
||||
IconImage = p2->image;
|
||||
@ -88,7 +88,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
group = shape->group;
|
||||
shapeNext = shape->next;
|
||||
while (group) {
|
||||
if (strcmp(group->id, IconName) == 0) {
|
||||
if (strcmp(group->id, IconNameX.c_str()) == 0) {
|
||||
break;
|
||||
}
|
||||
group = group->next;
|
||||
@ -103,24 +103,29 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
(Id == BUILTIN_ICON_BANNER)) {
|
||||
shape->debug = TRUE;
|
||||
} */
|
||||
if (BootCampStyle && (strstr(IconName, "selection_big") != NULL)) {
|
||||
// if (BootCampStyle && (strstr(IconName, "selection_big") != NULL)) {
|
||||
// shape->opacity = 0.f;
|
||||
// }
|
||||
if (BootCampStyle && IconNameX.ExistIn("selection_big")) {
|
||||
shape->opacity = 0.f;
|
||||
}
|
||||
if (strstr(shape->id, "BoundingRect") != NULL) {
|
||||
// if (strstr(shape->id, "BoundingRect") != NULL) {
|
||||
if (XString().takeValueFrom(shape->id).ExistIn("BoundingRect")) {
|
||||
//there is bounds after nsvgParse()
|
||||
IconImage->width = shape->bounds[2] - shape->bounds[0];
|
||||
IconImage->height = shape->bounds[3] - shape->bounds[1];
|
||||
if ( IconImage->height != 0 ) { // !fontSVG->unitsPerEm generate a warning
|
||||
IconImage->height = 200;
|
||||
// DBG("parsed bounds: %f, %f\n", IconImage->width, IconImage->height);
|
||||
if ( IconImage->height < 1.f ) {
|
||||
IconImage->height = 200.f;
|
||||
}
|
||||
|
||||
if ((strstr(IconName, "selection_big") != NULL) && (!SelectionOnTop)) {
|
||||
MainEntriesSize = (int)(IconImage->width * iconScale); //xxx
|
||||
row0TileSize = MainEntriesSize + (int)(16.f * iconScale);
|
||||
if (IconNameX.ExistIn("selection_big") && (!SelectionOnTop)) {
|
||||
MainEntriesSize = (int)(IconImage->width * Scale); //xxx
|
||||
row0TileSize = MainEntriesSize + (int)(16.f * Scale);
|
||||
DBG("main entry size = %lld\n", MainEntriesSize);
|
||||
}
|
||||
if ((strstr(IconName, "selection_small") != NULL) && (!SelectionOnTop)) {
|
||||
row1TileSize = (int)(IconImage->width * iconScale);
|
||||
if (IconNameX.ExistIn("selection_small") && (!SelectionOnTop)) {
|
||||
row1TileSize = (int)(IconImage->width * Scale);
|
||||
}
|
||||
|
||||
// not exclude BoundingRect from IconImage?
|
||||
@ -167,13 +172,16 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
group = clipPaths->shapes->group;
|
||||
clipNext = clipPaths->next;
|
||||
while (group) {
|
||||
if (strcmp(group->id, IconName) == 0) {
|
||||
// if (strcmp(group->id, IconNameX.c_str()) == 0) {
|
||||
// break;
|
||||
// }
|
||||
if (IconNameX == XString().takeValueFrom(group->id)) {
|
||||
break;
|
||||
}
|
||||
group = group->parent;
|
||||
}
|
||||
if (group) {
|
||||
DBG("found clipPaths for %s\n", IconName);
|
||||
DBG("found clipPaths for %s\n", IconNameX.c_str());
|
||||
IconImage->clipPaths = SVGimage->clipPaths;
|
||||
break;
|
||||
}
|
||||
@ -192,14 +200,17 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
bounds[3] = -FLT_MAX;
|
||||
nsvg__imageBounds(p2, bounds);
|
||||
CopyMem(IconImage->realBounds, bounds, 4 * sizeof(float));
|
||||
if ((Id == BUILTIN_ICON_BANNER) && (strstr(IconName, "Banner") != NULL)) {
|
||||
BannerPosX = (int)(bounds[0] * iconScale - CentreShift);
|
||||
BannerPosY = (int)(bounds[1] * iconScale);
|
||||
if ((Id == BUILTIN_ICON_BANNER) && IconNameX.ExistIn("Banner")) {
|
||||
BannerPosX = (int)(bounds[0] * Scale - CentreShift);
|
||||
if (BannerPosX < 0) {
|
||||
BannerPosX = 1; //one pixel
|
||||
}
|
||||
BannerPosY = (int)(bounds[1] * Scale);
|
||||
DBG("Banner position at parse [%lld,%lld]\n", BannerPosX, BannerPosY);
|
||||
}
|
||||
|
||||
float Height = IconImage->height * iconScale;
|
||||
float Width = IconImage->width * iconScale;
|
||||
float Height = IconImage->height * Scale;
|
||||
float Width = IconImage->width * Scale;
|
||||
// DBG("icon %s width=%f height=%f\n", IconName, Width, Height);
|
||||
int iWidth = (int)(Width + 0.5f);
|
||||
int iHeight = (int)(Height + 0.5f);
|
||||
@ -215,14 +226,14 @@ EFI_STATUS XTheme::ParseSVGXIcon(void *parser, INTN Id, const XString& IconNameX
|
||||
float tx = 0.f, ty = 0.f;
|
||||
if ((Id != BUILTIN_ICON_BACKGROUND) &&
|
||||
(Id != BUILTIN_ICON_ANIME) &&
|
||||
(strstr(IconName, "Banner") == NULL)) {
|
||||
float realWidth = (bounds[2] - bounds[0]) * iconScale;
|
||||
float realHeight = (bounds[3] - bounds[1]) * iconScale;
|
||||
IconNameX.ExistIn("Banner")) {
|
||||
float realWidth = (bounds[2] - bounds[0]) * Scale;
|
||||
float realHeight = (bounds[3] - bounds[1]) * Scale;
|
||||
tx = (Width - realWidth) * 0.5f;
|
||||
ty = (Height - realHeight) * 0.5f;
|
||||
}
|
||||
|
||||
nsvgRasterize(rast, IconImage, tx,ty,iconScale,iconScale, (UINT8*)NewImage.GetPixelPtr(0,0), iWidth, iHeight, iWidth*4);
|
||||
nsvgRasterize(rast, IconImage, tx, ty, Scale, Scale, (UINT8*)NewImage.GetPixelPtr(0,0), iWidth, iHeight, iWidth*4);
|
||||
// DBG("%s rastered, blt\n", IconImage);
|
||||
|
||||
nsvgDeleteRasterizer(rast);
|
||||
@ -432,14 +443,14 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
// must be svg view-box
|
||||
float vbx = mainParser->viewWidth;
|
||||
float vby = mainParser->viewHeight;
|
||||
DBG("Theme view-bounds: w=%f h=%f units=px\n", vbx, vby);
|
||||
DBG("Theme view-bounds: w=%f h=%f units=px\n", vbx, vby); //Theme view-bounds: w=1600.000000 h=900.000000 units=px
|
||||
if (vby > 1.0f) {
|
||||
SVGimage->height = vby;
|
||||
} else {
|
||||
SVGimage->height = 768.f; //default height
|
||||
}
|
||||
float ScaleF = UGAHeight / SVGimage->height;
|
||||
DBG("using scale %f\n", ScaleF);
|
||||
DBG("using scale %f\n", ScaleF); // using scale 0.666667
|
||||
Scale = ScaleF;
|
||||
CentreShift = (vbx * Scale - (float)UGAWidth) * 0.5f;
|
||||
|
||||
@ -453,24 +464,24 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
}
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!DayLight) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BACKGROUND, "Background_night"_XS, Scale, &BigBack);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BACKGROUND, "Background_night"_XS, &BigBack);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BACKGROUND, "Background"_XS, Scale, &BigBack);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BACKGROUND, "Background"_XS, &BigBack);
|
||||
}
|
||||
DBG(" Background parsed [%lld, %lld]\n", BigBack.GetWidth(), BigBack.GetHeight());
|
||||
DBG(" Background parsed [%lld, %lld]\n", BigBack.GetWidth(), BigBack.GetHeight()); //Background parsed [1067, 133]
|
||||
// --- Make Banner
|
||||
Banner.setEmpty(); //for the case of theme switch
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!DayLight) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BANNER, "Banner_night"_XS, Scale, &Banner);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BANNER, "Banner_night"_XS, &Banner);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BANNER, "Banner"_XS, Scale, &Banner);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_BANNER, "Banner"_XS, &Banner);
|
||||
}
|
||||
DBG("Banner parsed\n");
|
||||
BanHeight = (int)(Banner.GetHeight() * Scale + 1.f);
|
||||
DBG(" parsed banner->width=%lld height=%lld\n", Banner.GetWidth(), BanHeight);
|
||||
DBG(" parsed banner->width=%lld height=%lld\n", Banner.GetWidth(), BanHeight); //parsed banner->width=467 height=89
|
||||
|
||||
// --- Make other icons
|
||||
|
||||
@ -479,14 +490,14 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
continue;
|
||||
}
|
||||
Icon* NewIcon = new Icon(i, false); //initialize without embedded
|
||||
Status = ParseSVGXIcon(mainParser, i, NewIcon->Name, Scale, &NewIcon->Image);
|
||||
Status = ParseSVGXIcon(mainParser, i, NewIcon->Name, &NewIcon->Image);
|
||||
if (EFI_ERROR(Status) &&
|
||||
(i >= BUILTIN_ICON_VOL_INTERNAL_HFS) &&
|
||||
(i <= BUILTIN_ICON_VOL_INTERNAL_REC)) {
|
||||
NewIcon->Image = GetIcon(BUILTIN_ICON_VOL_INTERNAL); //copy existing
|
||||
}
|
||||
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
|
||||
Status = ParseSVGXIcon(mainParser, i, NewIcon->Name + "_night"_XS, Scale, &NewIcon->ImageNight);
|
||||
Status = ParseSVGXIcon(mainParser, i, NewIcon->Name + "_night"_XS, &NewIcon->ImageNight);
|
||||
// DBG("...night status %s\n", strerror(Status));
|
||||
if (EFI_ERROR(Status) &&
|
||||
(i >= BUILTIN_ICON_VOL_INTERNAL_HFS) &&
|
||||
@ -508,10 +519,10 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
//selection for bootcamp style
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!DayLight) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS, Scale, &SelectionImages[4]);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS, &SelectionImages[4]);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, "selection_indicator"_XS, Scale, &SelectionImages[4]);
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, "selection_indicator"_XS, &SelectionImages[4]);
|
||||
}
|
||||
|
||||
//buttons
|
||||
@ -748,7 +759,7 @@ EG_IMAGE * LoadSvgFrame(INTN i)
|
||||
XFrameName += SPrintf("%lld", i+1);
|
||||
// printf(FrameName, 63, "frame_%lld", i+1);
|
||||
|
||||
Status = ThemeX.ParseSVGXIcon(mainParser, BUILTIN_ICON_ANIME, XFrameName, ThemeX.Scale, &XFrame);
|
||||
Status = ThemeX.ParseSVGXIcon(mainParser, BUILTIN_ICON_ANIME, XFrameName, &XFrame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("icon '%s' not loaded, status=%s\n", XFrameName.c_str(), strerror(Status));
|
||||
}
|
||||
@ -777,6 +788,7 @@ EG_IMAGE * LoadSvgFrame(INTN i)
|
||||
//textType = 0-help 1-message 2-menu 3-test
|
||||
//return text width in pixels
|
||||
#if USE_XTHEME
|
||||
//it is not theme member!
|
||||
INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType, const XStringW& string, UINTN Cursor)
|
||||
{
|
||||
XImage& TextBufferXY = *TextBufferXY_ptr;
|
||||
@ -822,14 +834,14 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
|
||||
len = string.size();
|
||||
Width = TextBufferXY.GetWidth();
|
||||
if ( fontSVG->unitsPerEm != 0 ) { // !fontSVG->unitsPerEm generate a warning
|
||||
if ( fontSVG->unitsPerEm < 1.f ) {
|
||||
fontSVG->unitsPerEm = 1000.f;
|
||||
}
|
||||
float fH = fontSVG->bbox[3] - fontSVG->bbox[1]; //1250
|
||||
if (fH == 0.f) {
|
||||
DBG("wrong font: %f\n", fontSVG->unitsPerEm);
|
||||
DumpFloat2("Font bbox", fontSVG->bbox, 4);
|
||||
fH = fontSVG->unitsPerEm != 0 ? fontSVG->unitsPerEm : 1000.0f; //1000
|
||||
fH = (fontSVG->unitsPerEm > 1.f) ? fontSVG->unitsPerEm : 1000.0f; //1000
|
||||
}
|
||||
sy = (float)Height / fH; //(float)fontSVG->unitsPerEm; // 260./1250.
|
||||
Scale = sy;
|
||||
@ -841,7 +853,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
if (!letter) {
|
||||
break;
|
||||
}
|
||||
// DBG("add letter 0x%X\n", letter);
|
||||
// DBG("add letter 0x%X\n", letter);
|
||||
if (i == Cursor) {
|
||||
addLetter(p, 0x5F, x, y, sy, color);
|
||||
}
|
||||
@ -916,14 +928,14 @@ INTN renderSVGtext(EG_IMAGE* TextBufferXY, INTN posX, INTN posY, INTN textType,
|
||||
|
||||
// Height = 180; //for test
|
||||
// DBG("textBuffer: [%d,%d], fontUnits=%d\n", Width, TextBufferXY->Height, (int)fontSVG->unitsPerEm);
|
||||
if ( fontSVG->unitsPerEm == 0 ) { // doing "if (!fontSVG->unitsPerEm)" generates a warning
|
||||
if ( fontSVG->unitsPerEm < 1.f ) {
|
||||
fontSVG->unitsPerEm = 1000.f;
|
||||
}
|
||||
float fH = fontSVG->bbox[3] - fontSVG->bbox[1]; //1250
|
||||
if (fH == 0.f) {
|
||||
DBG("wrong font: %f\n", fontSVG->unitsPerEm);
|
||||
DumpFloat2("Font bbox", fontSVG->bbox, 4);
|
||||
fH = fontSVG->unitsPerEm != 0 ? fontSVG->unitsPerEm : 1000.0f; //1000 // using "fontSVG->unitsPerEm != 0" instead of just is to avoid a warning
|
||||
fH = fontSVG->unitsPerEm != 0.f ? fontSVG->unitsPerEm : 1000.0f;
|
||||
}
|
||||
sy = (float)Height / fH; //(float)fontSVG->unitsPerEm; // 260./1250.
|
||||
//in font units
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
EFI_STATUS GetThemeTagSettings(void* DictPointer);
|
||||
void parseTheme(void* p, const char** dict); //in nano project
|
||||
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
|
||||
EFI_STATUS ParseSVGXIcon(void *p, INTN Id, const XString& IconNameX, float Scale, XImage* Image);
|
||||
EFI_STATUS ParseSVGXIcon(void *p, INTN Id, const XString& IconNameX, XImage* Image);
|
||||
void* LoadTheme(const CHAR16 *TestTheme); //return TagPtr why?
|
||||
|
||||
//screen operations
|
||||
|
Loading…
Reference in New Issue
Block a user