Fixed bug in path number parsing in exponent form (i.e. 6e-5)

This commit is contained in:
Mikko Mononen 2014-01-23 19:02:23 +02:00
parent 95daad571d
commit 87aed6d1fc
2 changed files with 5 additions and 8 deletions

3
.gitignore vendored
View File

@ -24,5 +24,8 @@ Thumbs.db
## Build dir ## Build dir
build/* build/*
## Stuff in example
example/_*
## xcode specific ## xcode specific
*xcuserdata* *xcuserdata*

View File

@ -513,7 +513,6 @@ error:
static void nsvg__addPath(struct NSVGParser* p, char closed) static void nsvg__addPath(struct NSVGParser* p, char closed)
{ {
float* t = NULL;
struct NSVGAttrib* attr = nsvg__getAttr(p); struct NSVGAttrib* attr = nsvg__getAttr(p);
struct NSVGpath* path = NULL; struct NSVGpath* path = NULL;
int i; int i;
@ -534,9 +533,8 @@ static void nsvg__addPath(struct NSVGParser* p, char closed)
path->npts = p->npts; path->npts = p->npts;
// Transform path. // Transform path.
t = attr->xform;
for (i = 0; i < p->npts; ++i) for (i = 0; i < p->npts; ++i)
nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], t); nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform);
path->next = p->plist; path->next = p->plist;
p->plist = path; p->plist = path;
@ -558,11 +556,7 @@ static const char* nsvg__getNextPathItem(const char* s, char* it)
while (*s && (nsvg__isspace(*s) || *s == ',')) s++; while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
if (!*s) return s; if (!*s) return s;
if (*s == '-' || *s == '+' || nsvg__isnum(*s)) { if (*s == '-' || *s == '+' || nsvg__isnum(*s)) {
while (*s == '-' || *s == '+') { while (*s && nsvg__isnum(*s)) {
if (i < 63) it[i++] = *s;
s++;
}
while (*s && *s != '-' && *s != '+' && nsvg__isnum(*s)) {
if (i < 63) it[i++] = *s; if (i < 63) it[i++] = *s;
s++; s++;
} }