From: Ben Harris Date: Sat, 2 Nov 2024 19:32:17 +0000 (+0000) Subject: Put the charstring cursor in a local variable X-Git-Tag: bedstead-3.246~64 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=82447229df3cb6b2d716f74a08d01418cc8f2aad;p=bedstead.git Put the charstring cursor in a local variable --- diff --git a/bedstead.c b/bedstead.c index 2b80a3b..75bb335 100644 --- a/bedstead.c +++ b/bedstead.c @@ -3564,10 +3564,8 @@ clean_path(void) } while (done_anything); } -static vec cur; - static void -emit_contour(point *p0) +emit_contour(point *p0, vec *cur) { point *p = p0, *p1; int stacksize = 0; @@ -3576,11 +3574,11 @@ emit_contour(point *p0) do { stacksize += 2; printf(" %g %g %s\n", - (double)(p->v.x - cur.x) / XSCALE, - (double)(p->v.y - cur.y) / YSCALE, + (double)(p->v.x - cur->x) / XSCALE, + (double)(p->v.y - cur->y) / YSCALE, p == p0 ? "rmoveto" : stacksize >= 48 ? "rlineto" : ""); stacksize %= 48; - cur = p->v; + *cur = p->v; p1 = p->next; p->prev = p->next = NULL; p = p1; @@ -3593,9 +3591,8 @@ emit_path(void) { int i, pass; point *p; + struct vec cur = { 0, DESCENT * YPIX }; - cur.x = 0; - cur.y = DESCENT * YPIX; /* * On the first pass, emit open contours (if there are any). * On the second pass, emit all remaining contours. @@ -3604,7 +3601,7 @@ emit_path(void) for (i = 0; i < nextpoint; i++) { p = &points[i]; if (p->next && (!p->prev || pass == 1)) - emit_contour(p); + emit_contour(p, &cur); } } printf("endchar\n");