From 87aed6d1fc7c844b1ef8e6ca158cb3ca3385069c Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Thu, 23 Jan 2014 19:02:23 +0200 Subject: [PATCH] Fixed bug in path number parsing in exponent form (i.e. 6e-5) --- .gitignore | 3 +++ src/nanosvg.h | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 70f534e..5b3d1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,8 @@ Thumbs.db ## Build dir build/* +## Stuff in example +example/_* + ## xcode specific *xcuserdata* diff --git a/src/nanosvg.h b/src/nanosvg.h index e204bb7..3db337d 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -513,7 +513,6 @@ error: static void nsvg__addPath(struct NSVGParser* p, char closed) { - float* t = NULL; struct NSVGAttrib* attr = nsvg__getAttr(p); struct NSVGpath* path = NULL; int i; @@ -534,9 +533,8 @@ static void nsvg__addPath(struct NSVGParser* p, char closed) path->npts = p->npts; // Transform path. - t = attr->xform; 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; p->plist = path; @@ -558,11 +556,7 @@ static const char* nsvg__getNextPathItem(const char* s, char* it) while (*s && (nsvg__isspace(*s) || *s == ',')) s++; if (!*s) return s; if (*s == '-' || *s == '+' || nsvg__isnum(*s)) { - while (*s == '-' || *s == '+') { - if (i < 63) it[i++] = *s; - s++; - } - while (*s && *s != '-' && *s != '+' && nsvg__isnum(*s)) { + while (*s && nsvg__isnum(*s)) { if (i < 63) it[i++] = *s; s++; }