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

Function nsvg__parseSVG

rEFIt_UEFI/libeg/nanosvg.cpp:3234–3276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3232}
3233
3234static void nsvg__parseSVG(NSVGparser* p, const char** attr)
3235{
3236 int i;
3237 for (i = 0; attr[i]; i += 2) {
3238 if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
3239 if (strcmp(attr[i], "width") == 0) {
3240 p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
3241 } else if (strcmp(attr[i], "height") == 0) {
3242 p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
3243 } else if (strcmp(attr[i], "viewBox") == 0) {
3244 char* Next = 0;
3245 AsciiStrToFloat(attr[i + 1], &Next, &p->viewMinx);
3246 AsciiStrToFloat((const char*)Next, &Next, &p->viewMiny);
3247 AsciiStrToFloat((const char*)Next, &Next, &p->viewWidth);
3248 AsciiStrToFloat((const char*)Next, &Next, &p->viewHeight);
3249 } else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
3250 if (strstr(attr[i + 1], "none") != 0) {
3251 // No uniform scaling
3252 p->alignType = NSVG_ALIGN_NONE;
3253 } else {
3254 // Parse X align
3255 if (strstr(attr[i + 1], "xMin") != 0)
3256 p->alignX = NSVG_ALIGN_MIN;
3257 else if (strstr(attr[i + 1], "xMid") != 0)
3258 p->alignX = NSVG_ALIGN_MID;
3259 else if (strstr(attr[i + 1], "xMax") != 0)
3260 p->alignX = NSVG_ALIGN_MAX;
3261 // Parse X align
3262 if (strstr(attr[i + 1], "yMin") != 0)
3263 p->alignY = NSVG_ALIGN_MIN;
3264 else if (strstr(attr[i + 1], "yMid") != 0)
3265 p->alignY = NSVG_ALIGN_MID;
3266 else if (strstr(attr[i + 1], "yMax") != 0)
3267 p->alignY = NSVG_ALIGN_MAX;
3268 // Parse meet/slice
3269 p->alignType = NSVG_ALIGN_MEET;
3270 if (strstr(attr[i + 1], "slice") != 0)
3271 p->alignType = NSVG_ALIGN_SLICE;
3272 }
3273 }
3274 }
3275 }
3276}
3277
3278static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
3279{

Callers 1

nsvg__startElementFunction · 0.85

Calls 5

nsvg__parseAttrFunction · 0.85
nsvg__parseCoordinateFunction · 0.85
AsciiStrToFloatFunction · 0.85
strstrFunction · 0.85
strcmpFunction · 0.50

Tested by

no test coverage detected