Updated nanosvg.

This commit is contained in:
Aloshi 2014-03-29 08:51:59 -05:00
parent 6f64e647b9
commit e719a867be

View file

@ -663,6 +663,7 @@ static struct NSVGgradientData* nsvg__findGradientData(struct NSVGparser* p, con
while (grad) { while (grad) {
if (strcmp(grad->id, id) == 0) if (strcmp(grad->id, id) == 0)
return grad; return grad;
grad = grad->next;
} }
return NULL; return NULL;
} }
@ -1311,10 +1312,10 @@ static int nsvg__parseRotate(float* xform, const char* str)
} }
nsvg__xformSetRotation(t, args[0]/180.0f*NSVG_PI); nsvg__xformSetRotation(t, args[0]/180.0f*NSVG_PI);
nsvg__xformPremultiply(0, t); nsvg__xformPremultiply(m, t);
if (na > 1) { if (na > 1) {
nsvg__xformSetTranslation(xform, args[1], args[2]); nsvg__xformSetTranslation(t, args[1], args[2]);
nsvg__xformPremultiply(m, t); nsvg__xformPremultiply(m, t);
} }
@ -1325,22 +1326,28 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str) static void nsvg__parseTransform(float* xform, const char* str)
{ {
float t[6];
nsvg__xformIdentity(xform);
while (*str) while (*str)
{ {
if (strncmp(str, "matrix", 6) == 0) if (strncmp(str, "matrix", 6) == 0)
str += nsvg__parseMatrix(xform, str); str += nsvg__parseMatrix(t, str);
else if (strncmp(str, "translate", 9) == 0) else if (strncmp(str, "translate", 9) == 0)
str += nsvg__parseTranslate(xform, str); str += nsvg__parseTranslate(t, str);
else if (strncmp(str, "scale", 5) == 0) else if (strncmp(str, "scale", 5) == 0)
str += nsvg__parseScale(xform, str); str += nsvg__parseScale(t, str);
else if (strncmp(str, "rotate", 6) == 0) else if (strncmp(str, "rotate", 6) == 0)
str += nsvg__parseRotate(xform, str); str += nsvg__parseRotate(t, str);
else if (strncmp(str, "skewX", 5) == 0) else if (strncmp(str, "skewX", 5) == 0)
str += nsvg__parseSkewX(xform, str); str += nsvg__parseSkewX(t, str);
else if (strncmp(str, "skewY", 5) == 0) else if (strncmp(str, "skewY", 5) == 0)
str += nsvg__parseSkewY(xform, str); str += nsvg__parseSkewY(t, str);
else else{
++str; ++str;
continue;
}
nsvg__xformPremultiply(xform, t);
} }
} }