From 680298e61ce664e95b3f8143c0c0b814d5966f2a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 10 Jul 2009 18:36:49 +0000 Subject: plotters line refactor svn path=/trunk/netsurf/; revision=8446 --- desktop/save_pdf/pdf_plotters.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'desktop/save_pdf/pdf_plotters.c') diff --git a/desktop/save_pdf/pdf_plotters.c b/desktop/save_pdf/pdf_plotters.c index 468c19ed1..58df607d6 100644 --- a/desktop/save_pdf/pdf_plotters.c +++ b/desktop/save_pdf/pdf_plotters.c @@ -46,8 +46,7 @@ /* #define PDF_DEBUG_DUMPGRID */ static bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style); -static bool pdf_plot_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed); +static bool pdf_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *pstyle); static bool pdf_plot_polygon(const int *p, unsigned int n, colour fill); static bool pdf_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1); @@ -200,16 +199,30 @@ bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *psty return true; } -bool pdf_plot_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed) +bool pdf_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *pstyle) { -#ifdef PDF_DEBUG - LOG((".")); -#endif + DashPattern_e dash; + + switch (pstyle->stroke_type) { + case PLOT_OP_TYPE_DOT: + dash = DashPattern_eDotted; + break; + + case PLOT_OP_TYPE_DASH: + dash = DashPattern_eDash; + break; + + default: + dash = DashPattern_eNone; + break; + + } - apply_clip_and_mode(false, TRANSPARENT, c, width, - (dotted) ? DashPattern_eDotted : - ((dashed) ? DashPattern_eDash : DashPattern_eNone)); + apply_clip_and_mode(false, + TRANSPARENT, + pstyle->stroke_colour, + pstyle->stroke_width, + dash); HPDF_Page_MoveTo(pdf_page, x0, page_height - y0); HPDF_Page_LineTo(pdf_page, x1, page_height - y1); -- cgit v1.2.3