Storing pointer to path data instead of index. As per memononen's feedback.

This commit is contained in:
Bryan McConkey 2014-02-23 12:08:23 -05:00
parent 5a48c96aac
commit 1666f36021

View File

@ -1814,7 +1814,7 @@ static void nsvg__pathArcTo(struct NSVGparser* p, float* cpx, float* cpy, float*
static void nsvg__parsePath(struct NSVGparser* p, const char** attr) static void nsvg__parsePath(struct NSVGparser* p, const char** attr)
{ {
const char* s; const char* s = NULL;
char cmd; char cmd;
float args[10]; float args[10];
int nargs; int nargs;
@ -1824,11 +1824,10 @@ static void nsvg__parsePath(struct NSVGparser* p, const char** attr)
char closedFlag; char closedFlag;
int i; int i;
char item[64]; char item[64];
int dAttrIndex = -1;
for (i = 0; attr[i]; i += 2) { for (i = 0; attr[i]; i += 2) {
if (strcmp(attr[i], "d") == 0) { if (strcmp(attr[i], "d") == 0) {
dAttrIndex = i; s = attr[i + 1];
} else { } else {
tmp[0] = attr[i]; tmp[0] = attr[i];
tmp[1] = attr[i + 1]; tmp[1] = attr[i + 1];
@ -1838,10 +1837,8 @@ static void nsvg__parsePath(struct NSVGparser* p, const char** attr)
} }
} }
if(dAttrIndex >= 0) if(s)
{ {
s = attr[dAttrIndex + 1];
nsvg__resetPath(p); nsvg__resetPath(p);
cpx = 0; cpy = 0; cpx = 0; cpy = 0;
closedFlag = 0; closedFlag = 0;