Fix for nsvg__parseTransform not parsing multiple transformations

This commit is contained in:
Bryan McConkey 2014-03-28 23:06:15 -04:00
parent e937a513c6
commit 6cc0d0163e

View File

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