summaryrefslogtreecommitdiff
path: root/frontends/gtk/plotters.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/gtk/plotters.c')
-rw-r--r--frontends/gtk/plotters.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/frontends/gtk/plotters.c b/frontends/gtk/plotters.c
index 88e7760c6..4a5ef510c 100644
--- a/frontends/gtk/plotters.c
+++ b/frontends/gtk/plotters.c
@@ -89,6 +89,20 @@ static inline void nsgtk_set_dashed(void)
/**
+ * Set cairo context line width.
+ */
+static inline void nsgtk_set_line_width(plot_style_fixed width)
+{
+ if (width == 0) {
+ cairo_set_line_width(current_cr, 1);
+ } else {
+ cairo_set_line_width(current_cr,
+ plot_style_fixed_to_double(width));
+ }
+}
+
+
+/**
* \brief Sets a clip rectangle for subsequent plot operations.
*
* \param ctx The current redraw context.
@@ -191,10 +205,7 @@ nsgtk_plot_disc(const struct redraw_context *ctx,
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
cairo_arc(current_cr, x, y, radius, 0, M_PI * 2);
@@ -242,10 +253,7 @@ nsgtk_plot_line(const struct redraw_context *ctx,
nsgtk_set_colour(style->stroke_colour);
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
/* core expects horizontal and vertical lines to be on pixels, not
* between pixels
@@ -331,10 +339,7 @@ nsgtk_plot_rectangle(const struct redraw_context *ctx,
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
cairo_rectangle(current_cr,
rect->x0 + 0.5,
@@ -394,7 +399,6 @@ nsgtk_plot_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot.
* \param p elements of path
* \param n nunber of elements on path
- * \param width The width of the path
* \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code.
*/
@@ -403,7 +407,6 @@ nsgtk_plot_path(const struct redraw_context *ctx,
const plot_style_t *pstyle,
const float *p,
unsigned int n,
- float width,
const float transform[6])
{
unsigned int i;
@@ -421,7 +424,7 @@ nsgtk_plot_path(const struct redraw_context *ctx,
cairo_get_matrix(current_cr, &old_ctm);
/* Set up line style and width */
- cairo_set_line_width(current_cr, 1);
+ nsgtk_set_line_width(pstyle->stroke_width);
nsgtk_set_solid();
/* Load new CTM */