{
gfxline_t*start;
gfxline_t*next;
+ gfxcoord_t x0,y0;
} linedraw_internal_t;
static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
return;
}
+ i->x0 = x;
+ i->y0 = y;
l->sx = l->sy = 0;
d->x = l->x = x;
d->y = l->y = y;
gfxline_t*l = (gfxline_t*)rfx_alloc(sizeof(gfxline_t));
if(!i->start) {
- /* starts with a line, not with a moveto. That needs we first
- need an explicit moveto to (0,0) */
- linedraw_moveTo(d, 0, 0);
+ /* starts with a line, not with a moveto. As this is the first
+ entry in the list, this is probably *meant* to be a moveto */
+ linedraw_moveTo(d, x, y);
+ return;
}
l->type = gfx_lineTo;
gfxline_t*l = (gfxline_t*)rfx_alloc(sizeof(gfxline_t));
if(!i->start) {
- /* starts with a line, not with a moveto. That needs we first
- need an explicit moveto to (0,0) */
- linedraw_moveTo(d, 0, 0);
+ fprintf(stderr, "Error: drawing startpoint is a spline\n");
+ linedraw_moveTo(d, x, y);
+ return;
}
l->type = gfx_splineTo;
if(!i->start)
i->start = l;
}
+static void* linedraw_close(gfxdrawer_t*d)
+{
+ linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
+ linedraw_lineTo(d, i->x0, i->y0);
+}
static void* linedraw_result(gfxdrawer_t*d)
{
linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
d->moveTo = linedraw_moveTo;
d->lineTo = linedraw_lineTo;
d->splineTo = linedraw_splineTo;
+ d->close = linedraw_close;
d->result = linedraw_result;
}