| 3232 | } |
| 3233 | |
| 3234 | static 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 | |
| 3278 | static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type) |
| 3279 | { |
no test coverage detected