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

Function nsvg__parseEllipse

rEFIt_UEFI/libeg/nanosvg.cpp:2999–3026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2997}
2998
2999static void nsvg__parseEllipse(NSVGparser* p, const char** attr)
3000{
3001 float cx = 0.0f;
3002 float cy = 0.0f;
3003 float rx = 0.0f;
3004 float ry = 0.0f;
3005 int i;
3006
3007 for (i = 0; attr[i]; i += 2) {
3008 if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
3009 if (strcmp(attr[i], "cx") == 0) cx = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
3010 else if (strcmp(attr[i], "cy") == 0) cy = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
3011 else if (strcmp(attr[i], "rx") == 0) rx = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p)));
3012 else if (strcmp(attr[i], "ry") == 0) ry = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p)));
3013 }
3014 }
3015
3016 if (rx > 0.0f && ry > 0.0f) {
3017 nsvg__resetPath(p);
3018 nsvg__moveTo(p, cx+rx, cy);
3019 nsvg__cubicBezTo(p, cx+rx, cy+ry*NSVG_KAPPA90, cx+rx*NSVG_KAPPA90, cy+ry, cx, cy+ry);
3020 nsvg__cubicBezTo(p, cx-rx*NSVG_KAPPA90, cy+ry, cx-rx, cy+ry*NSVG_KAPPA90, cx-rx, cy);
3021 nsvg__cubicBezTo(p, cx-rx, cy-ry*NSVG_KAPPA90, cx-rx*NSVG_KAPPA90, cy-ry, cx, cy-ry);
3022 nsvg__cubicBezTo(p, cx+rx*NSVG_KAPPA90, cy-ry, cx+rx, cy-ry*NSVG_KAPPA90, cx+rx, cy);
3023 nsvg__addPath(p, 1);
3024 nsvg__addShape(p);
3025 }
3026}
3027
3028static void nsvg__parseLine(NSVGparser* p, const char** attr)
3029{

Callers 1

nsvg__startElementFunction · 0.85

Calls 13

nsvg__parseAttrFunction · 0.85
nsvg__parseCoordinateFunction · 0.85
nsvg__actualOrigXFunction · 0.85
nsvg__actualWidthFunction · 0.85
nsvg__actualOrigYFunction · 0.85
nsvg__actualHeightFunction · 0.85
fabsfFunction · 0.85
nsvg__resetPathFunction · 0.85
nsvg__moveToFunction · 0.85
nsvg__cubicBezToFunction · 0.85
nsvg__addPathFunction · 0.85
nsvg__addShapeFunction · 0.85

Tested by

no test coverage detected