From 90326e6b0d35ac8ca81f40cc36a252a6ecd916d4 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 21 Jan 2010 23:35:35 +0000 Subject: fix polylines svn path=/trunk/libnsfb/; revision=9855 --- include/libnsfb_plot.h | 2 +- include/plot.h | 2 +- src/plot/generic.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h index e0ee7de..34be612 100644 --- a/include/libnsfb_plot.h +++ b/include/libnsfb_plot.h @@ -105,7 +105,7 @@ bool nsfb_plot_lines(nsfb_t *nsfb, int linec, nsfb_bbox_t *line, nsfb_plot_pen_t * * Draw a series of connected lines. */ -bool nsfb_plot_polylines(nsfb_t *nsfb, int pointc, nsfb_point_t *points, nsfb_plot_pen_t *pen); +bool nsfb_plot_polylines(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen); /** Plots a filled polygon. * diff --git a/include/plot.h b/include/plot.h index 929daec..a745eb4 100644 --- a/include/plot.h +++ b/include/plot.h @@ -90,7 +90,7 @@ typedef bool (nsfb_plotfn_quadratic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, */ typedef bool (nsfb_plotfn_cubic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_colour_t c); -typedef bool (nsfb_plotfn_polylines_t)(nsfb_t *nsfb, int pointc, nsfb_point_t *points, nsfb_plot_pen_t *pen); +typedef bool (nsfb_plotfn_polylines_t)(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen); /** plot path */ typedef bool (nsfb_plotfn_path_t)(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen); diff --git a/src/plot/generic.c b/src/plot/generic.c index 8dbc64b..a367d14 100644 --- a/src/plot/generic.c +++ b/src/plot/generic.c @@ -604,13 +604,16 @@ static bool quadratic(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsf return true; } -static bool polylines(nsfb_t *nsfb, int pointc, nsfb_point_t *points, nsfb_plot_pen_t *pen) + +static bool polylines(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen) { int point_loop; + nsfb_bbox_t line; if (pen->stroke_type != NFSB_PLOT_OPTYPE_NONE) { for (point_loop = 0; point_loop < (pointc - 1); point_loop++) { - nsfb->plotter_fns->line(nsfb, 1, (nsfb_bbox_t *)&points[point_loop], pen); + line = *(nsfb_bbox_t *)&points[point_loop]; + nsfb->plotter_fns->line(nsfb, 1, &line, pen); } } return true; -- cgit v1.2.3