MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / ParseSVGXIcon

Method ParseSVGXIcon

rEFIt_UEFI/libeg/VectorGraphics.cpp:57–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55textFaces textFace[4]; //0-help 1-message 2-menu 3-test, far future it will be infinite list with id
56
57EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage* Image, OUT void **SVGIcon)
58{
59 EFI_STATUS Status = EFI_NOT_FOUND;
60 NSVGimage *SVGimage;
61 NSVGparser *p = (NSVGparser *)SVGParser;
62 NSVGrasterizer* rast = nsvgCreateRasterizer();
63 SVGimage = p->image;
64 NSVGshape *shape;
65 NSVGgroup *group;
66 NSVGimage *IconImage;
67 NSVGshape *shapeNext, *shapesTail = NULL, *shapePrev;
68
69 NSVGparser* p2 = nsvg__createParser();
70 IconImage = p2->image;
71 shape = SVGimage->shapes;
72 shapePrev = NULL;
73 while (shape) {
74 group = shape->group;
75 shapeNext = shape->next;
76 while (group) {
77 if (strcmp(group->id, IconNameX.c_str()) == 0) {
78 break;
79 }
80 group = group->next;
81 }
82 if (group) { //the shape is in the group
83 // keep this sample for debug purpose
84/* DBG("found shape %s", shape->id);
85 DBG(" from group %s\n", group->id);
86 if ((Id == BUILTIN_SELECTION_BIG) ||
87 (Id == BUILTIN_ICON_BACKGROUND) ||
88 (Id == BUILTIN_ICON_BANNER)) {
89 shape->debug = TRUE;
90 } */
91// if (BootCampStyle && (strstr(IconName, "selection_big") != NULL)) {
92// shape->opacity = 0.f;
93// }
94 if (BootCampStyle && IconNameX.contains("selection_big")) {
95 shape->opacity = 0.f;
96 }
97// if (strstr(shape->id, "BoundingRect") != NULL) {
98 if (XString8().takeValueFrom(shape->id).contains("BoundingRect")) {
99 //there is bounds after nsvgParse()
100 IconImage->width = shape->bounds[2] - shape->bounds[0];
101 IconImage->height = shape->bounds[3] - shape->bounds[1];
102 // DBG("parsed bounds: %f, %f\n", IconImage->width, IconImage->height);
103 if ( IconImage->height < 1.f ) {
104 IconImage->height = 200.f;
105 }
106 if (IconNameX.contains("selection_big") && (!SelectionOnTop)) {
107 MainEntriesSize = (int)(IconImage->width * Scale); //xxx
108 row0TileSize = MainEntriesSize + (int)(16.f * Scale);
109 // DBG("main entry size = %lld\n", MainEntriesSize);
110 }
111 if (IconNameX.contains("selection_small") && (!SelectionOnTop)) {
112 row1TileSize = (int)(IconImage->width * Scale);
113 }
114

Callers

nothing calls this directly

Calls 11

nsvgCreateRasterizerFunction · 0.85
nsvg__createParserFunction · 0.85
nsvg__imageBoundsFunction · 0.85
nsvgRasterizeFunction · 0.85
nsvgDeleteRasterizerFunction · 0.85
GetPixelPtrMethod · 0.80
strcmpFunction · 0.50
XString8Class · 0.50
CopyMemFunction · 0.50
c_strMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected