summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-08-29 21:10:51 +0100
committerVincent Sanders <vince@kyllikki.org>2018-08-29 21:10:51 +0100
commitbae4db1b59737e95bd11c60ca7f0abe7f1b6d994 (patch)
tree7319e7c7af5dd9e65d3a6aac9b6f5185f5070cc5
parent6f543d129bf6f73baefacf9ae5af19c0d2a74c2e (diff)
downloadnetsurf-vince/pdf.tar.gz
netsurf-vince/pdf.tar.bz2
fix plot style float to fix path widthvince/pdf
-rw-r--r--content/handlers/pdf/pdf.c21
-rw-r--r--include/netsurf/plot_style.h3
2 files changed, 15 insertions, 9 deletions
diff --git a/content/handlers/pdf/pdf.c b/content/handlers/pdf/pdf.c
index 89548cd46..ec283aa3a 100644
--- a/content/handlers/pdf/pdf.c
+++ b/content/handlers/pdf/pdf.c
@@ -1,6 +1,5 @@
/*
- * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
- * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
+ * Copyright 2018 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -154,7 +153,7 @@ static bool pdf_convert(struct content *c)
}
/** \todo extract documents starting page number */
- pdfc->current_page = 16;
+ pdfc->current_page = 0;
pdfres = nspdf_get_page_dimensions(pdfc->doc,
pdfc->current_page,
@@ -180,12 +179,16 @@ pdf_path(const struct nspdf_style *style,
{
const struct redraw_context *ctx = ctxin;
- ctx->plot->path(ctx,
- (const struct plot_style_s *)style,
- path,
- path_length,
- style->stroke_width,
- transform);
+ struct plot_style_s nsstyle;
+
+ nsstyle.stroke_type = style->stroke_type;
+ nsstyle.stroke_width = plot_style_float_to_fixed(style->stroke_width);
+ nsstyle.stroke_colour = style->stroke_colour;
+ nsstyle.fill_type = style->fill_type;
+ nsstyle.fill_colour = style->fill_colour;
+
+ ctx->plot->path(ctx, &nsstyle, path, path_length, transform);
+
return NSPDFERROR_OK;
}
diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h
index f1b617231..11d506d74 100644
--- a/include/netsurf/plot_style.h
+++ b/include/netsurf/plot_style.h
@@ -50,6 +50,9 @@ typedef int32_t plot_style_fixed;
/* Convert an int to fixed point */
#define plot_style_int_to_fixed(v) ((v) << PLOT_STYLE_RADIX)
+/* Convert an float to fixed point */
+#define plot_style_float_to_fixed(v) ((v) * (1<<PLOT_STYLE_RADIX))
+
/* Convert fixed point to int */
#define plot_style_fixed_to_int(v) ((v) >> PLOT_STYLE_RADIX)