| 2997 | } |
| 2998 | |
| 2999 | static 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 | |
| 3028 | static void nsvg__parseLine(NSVGparser* p, const char** attr) |
| 3029 | { |
no test coverage detected