Plotters: Remove width param from path plotter.

We now use the stroke_width in the plot_style.
This commit is contained in:
Michael Drake 2018-05-23 13:48:17 +01:00
parent 5f4f23f11a
commit 8332bf6b2a
14 changed files with 12 additions and 34 deletions

View File

@ -188,14 +188,14 @@ svg_redraw_internal(struct content *c,
for (i = 0; i != diagram->shape_count; i++) { for (i = 0; i != diagram->shape_count; i++) {
if (diagram->shape[i].path) { if (diagram->shape[i].path) {
pstyle.stroke_width = plot_style_int_to_fixed(
diagram->shape[i].stroke);
pstyle.stroke_colour = BGR(diagram->shape[i].stroke); pstyle.stroke_colour = BGR(diagram->shape[i].stroke);
pstyle.fill_colour = BGR(diagram->shape[i].fill); pstyle.fill_colour = BGR(diagram->shape[i].fill);
res = ctx->plot->path(ctx, res = ctx->plot->path(ctx,
&pstyle, &pstyle,
diagram->shape[i].path, diagram->shape[i].path,
diagram->shape[i].path_length, diagram->shape[i].path_length,
plot_style_int_to_fixed(
diagram->shape[i].stroke_width),
transform); transform);
if (res != NSERROR_OK) { if (res != NSERROR_OK) {
return false; return false;

View File

@ -671,7 +671,6 @@ knockout_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -680,14 +679,13 @@ knockout_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
nserror res; nserror res;
nserror ffres; nserror ffres;
ffres = knockout_plot_flush(ctx); ffres = knockout_plot_flush(ctx);
res = real_plot.path(ctx, pstyle, p, n, width, transform); res = real_plot.path(ctx, pstyle, p, n, transform);
/* return the first error */ /* return the first error */
if ((res != NSERROR_OK) && (ffres == NSERROR_OK)) { if ((res != NSERROR_OK) && (ffres == NSERROR_OK)) {

View File

@ -868,7 +868,6 @@ ami_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -877,7 +876,6 @@ ami_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
unsigned int i; unsigned int i;

View File

@ -2343,7 +2343,6 @@ plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -2352,7 +2351,6 @@ plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
/** \todo Implement atari path plot */ /** \todo Implement atari path plot */

View File

@ -518,7 +518,6 @@ nsbeos_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -527,7 +526,6 @@ nsbeos_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
unsigned int i; unsigned int i;
@ -578,7 +576,7 @@ nsbeos_plot_path(const struct redraw_context *ctx,
rgb_color old_high = view->HighColor(); rgb_color old_high = view->HighColor();
float old_pen = view->PenSize(); float old_pen = view->PenSize();
view->SetPenSize(width); view->SetPenSize(plot_style_fixed_to_float(pstyle->stroke_width));
view->MovePenTo(0, 0); view->MovePenTo(0, 0);
if (pstyle->fill_colour != NS_TRANSPARENT) { if (pstyle->fill_colour != NS_TRANSPARENT) {
view->SetHighColor(nsbeos_rgb_colour(pstyle->fill_colour)); view->SetHighColor(nsbeos_rgb_colour(pstyle->fill_colour));

View File

@ -261,7 +261,6 @@ framebuffer_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -270,7 +269,6 @@ framebuffer_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
NSLOG(netsurf, INFO, "path unimplemented"); NSLOG(netsurf, INFO, "path unimplemented");

View File

@ -399,7 +399,6 @@ nsgtk_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -408,7 +407,6 @@ nsgtk_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
unsigned int i; unsigned int i;
@ -426,7 +424,7 @@ nsgtk_plot_path(const struct redraw_context *ctx,
cairo_get_matrix(current_cr, &old_ctm); cairo_get_matrix(current_cr, &old_ctm);
/* Set up line style and width */ /* Set up line style and width */
cairo_set_line_width(current_cr, 1); nsgtk_set_line_width(pstyle->stroke_width);
nsgtk_set_solid(); nsgtk_set_solid();
/* Load new CTM */ /* Load new CTM */

View File

@ -427,7 +427,6 @@ nsgtk_print_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -436,7 +435,6 @@ nsgtk_print_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
/* Only the internal SVG renderer uses this plot call currently, /* Only the internal SVG renderer uses this plot call currently,

View File

@ -177,7 +177,6 @@ monkey_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -186,12 +185,11 @@ monkey_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
fprintf(stdout, fprintf(stdout,
"PLOT PATH VERTICIES %d WIDTH %f\n", "PLOT PATH VERTICIES %d WIDTH %f\n",
n, width); n, plot_style_fixed_to_float(pstyle->stroke_width));
return NSERROR_OK; return NSERROR_OK;
} }
@ -273,7 +271,7 @@ static const struct plotter_table plotters = {
.path = monkey_plot_path, .path = monkey_plot_path,
.bitmap = monkey_plot_bitmap, .bitmap = monkey_plot_bitmap,
.text = monkey_plot_text, .text = monkey_plot_text,
.option_knockout = true, .option_knockout = true,
}; };
const struct plotter_table* monkey_plotters = &plotters; const struct plotter_table* monkey_plotters = &plotters;

View File

@ -483,7 +483,6 @@ ro_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -492,7 +491,6 @@ ro_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
static const draw_line_style line_style = { static const draw_line_style line_style = {
@ -591,7 +589,9 @@ ro_plot_path(const struct redraw_context *ctx,
} }
error = xdraw_stroke((draw_path *) path, 0, &trfm, 0, error = xdraw_stroke((draw_path *) path, 0, &trfm, 0,
width * 2 * 256, &line_style, 0); plot_style_fixed_to_int(
pstyle->stroke_width) * 2 * 256,
&line_style, 0);
if (error) { if (error) {
NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s", NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s",
error->errnum, error->errmess); error->errnum, error->errmess);

View File

@ -831,7 +831,6 @@ print_fonts_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
return NSERROR_OK; return NSERROR_OK;

View File

@ -312,7 +312,6 @@ ro_save_draw_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -321,7 +320,6 @@ ro_save_draw_path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
pencil_code code; pencil_code code;
@ -409,7 +407,8 @@ ro_save_draw_path(const struct redraw_context *ctx,
pstyle->stroke_colour == NS_TRANSPARENT ? pstyle->stroke_colour == NS_TRANSPARENT ?
pencil_TRANSPARENT : pencil_TRANSPARENT :
pstyle->stroke_colour << 8, pstyle->stroke_colour << 8,
width, pencil_JOIN_MITRED, plot_style_fixed_to_int(style->stroke_width),
pencil_JOIN_MITRED,
pencil_CAP_BUTT, pencil_CAP_BUTT,
pencil_CAP_BUTT, pencil_CAP_BUTT,
0, 0,

View File

@ -814,7 +814,6 @@ polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -823,7 +822,6 @@ path(const struct redraw_context *ctx,
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]) const float transform[6])
{ {
NSLOG(plot, DEEPDEBUG, "path unimplemented"); NSLOG(plot, DEEPDEBUG, "path unimplemented");

View File

@ -220,7 +220,6 @@ struct plotter_table {
* \param pstyle Style controlling the path plot. * \param pstyle Style controlling the path plot.
* \param p elements of path * \param p elements of path
* \param n nunber of elements on path * \param n nunber of elements on path
* \param width The width of the path
* \param transform A transform to apply to the path. * \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code. * \return NSERROR_OK on success else error code.
*/ */
@ -229,7 +228,6 @@ struct plotter_table {
const plot_style_t *pstyle, const plot_style_t *pstyle,
const float *p, const float *p,
unsigned int n, unsigned int n,
float width,
const float transform[6]); const float transform[6]);
/** /**