Fixed issue #3

- added missing break after 'm'/'M' path command
- path command 'm'/'M' is converted to 'l'/'L' so that multiple
coordinate pairs behave correctly
- fixed rendering of first point on path
This commit is contained in:
Mikko Mononen 2014-01-02 20:43:27 +02:00
parent f5b57c1876
commit 297c2d5252
2 changed files with 7 additions and 2 deletions

View File

@ -138,8 +138,8 @@ void drawControlPts(float* pts, int npts, char closed)
glPointSize(6.0f);
glColor4ubv(lineColor);
glVertex2f(pts[0],pts[1]);
glBegin(GL_POINTS);
glVertex2f(pts[0],pts[1]);
for (i = 0; i < npts-1; i += 3) {
float* p = &pts[i*2];
glVertex2f(p[6],p[7]);
@ -149,9 +149,9 @@ void drawControlPts(float* pts, int npts, char closed)
// Points
glPointSize(3.0f);
glBegin(GL_POINTS);
glColor4ubv(bgColor);
glVertex2f(pts[0],pts[1]);
glBegin(GL_POINTS);
for (i = 0; i < npts-1; i += 3) {
float* p = &pts[i*2];
glColor4ubv(lineColor);

View File

@ -1399,6 +1399,11 @@ static void nsvg__parsePath(struct NSVGParser* p, const char** attr)
case 'm':
case 'M':
nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
// Moveto can be followed by multiple coordinate pairs,
// which should be treated as linetos.
cmd = (cmd =='m') ? 'l' : 'L';
rargs = nsvg__getArgsPerElement(cmd);
break;
case 'l':
case 'L':
nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0);