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:
parent
f5b57c1876
commit
297c2d5252
@ -138,8 +138,8 @@ void drawControlPts(float* pts, int npts, char closed)
|
|||||||
glPointSize(6.0f);
|
glPointSize(6.0f);
|
||||||
glColor4ubv(lineColor);
|
glColor4ubv(lineColor);
|
||||||
|
|
||||||
glVertex2f(pts[0],pts[1]);
|
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
|
glVertex2f(pts[0],pts[1]);
|
||||||
for (i = 0; i < npts-1; i += 3) {
|
for (i = 0; i < npts-1; i += 3) {
|
||||||
float* p = &pts[i*2];
|
float* p = &pts[i*2];
|
||||||
glVertex2f(p[6],p[7]);
|
glVertex2f(p[6],p[7]);
|
||||||
@ -149,9 +149,9 @@ void drawControlPts(float* pts, int npts, char closed)
|
|||||||
// Points
|
// Points
|
||||||
glPointSize(3.0f);
|
glPointSize(3.0f);
|
||||||
|
|
||||||
|
glBegin(GL_POINTS);
|
||||||
glColor4ubv(bgColor);
|
glColor4ubv(bgColor);
|
||||||
glVertex2f(pts[0],pts[1]);
|
glVertex2f(pts[0],pts[1]);
|
||||||
glBegin(GL_POINTS);
|
|
||||||
for (i = 0; i < npts-1; i += 3) {
|
for (i = 0; i < npts-1; i += 3) {
|
||||||
float* p = &pts[i*2];
|
float* p = &pts[i*2];
|
||||||
glColor4ubv(lineColor);
|
glColor4ubv(lineColor);
|
||||||
|
@ -1399,6 +1399,11 @@ static void nsvg__parsePath(struct NSVGParser* p, const char** attr)
|
|||||||
case 'm':
|
case 'm':
|
||||||
case 'M':
|
case 'M':
|
||||||
nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
|
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':
|
||||||
case 'L':
|
case 'L':
|
||||||
nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0);
|
nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user