Index: trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c =================================================================== --- trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c (revision 10240) +++ trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c (revision 10241) @@ -213,10 +213,9 @@ } } -static inline void ghid_cairo_draw_grid_global(void) +static inline void ghid_cairo_draw_grid_global(cairo_t *cr) { render_priv_t *priv = gport->render_priv; - cairo_t *cr = priv->cr; pcb_coord_t x, y, x1, y1, x2, y2, grd; int n, i; static GdkPoint *points = NULL; @@ -267,6 +266,22 @@ } if (n == 0) return; + + /* Draw N points... is this the most efficient ? At least, it works. + From cairo development : + " cairo_move_to (cr, x, y); + . cairo_line_to (cr, x, y); + . .. repeat for each point .. + . + . cairo_stroke (cr); + . + . Within the implementation (and test suite) we call these "degenerate" + . paths and we explicitly support drawing round caps for such degenerate + . paths. So this should work perfectly for the case of + . CAIRO_LINE_CAP_ROUND and you'll get the diameter controlled by + . cairo_set_line_width just like you want. + " + */ for (y = y1; y <= y2; y += grd) { for (i = 0; i < n; i++) { points[i].y = Vy(y); @@ -273,20 +288,6 @@ cairo_move_to(cr, points[i].x, points[i].y); cairo_line_to(cr, points[i].x, points[i].y); } - /*FIXME: problem: draw n points ... Efficiency ? */ - //gdk_draw_points(gport->drawable, priv->grid_gc, points, n); - -// cairo_move_to (cr, x, y); -// cairo_line_to (cr, x, y); -// /* repeat for each point */ -// -// cairo_stroke (cr); -// -// Within the implementation (and test suite) we call these "degenerate" -// paths and we explicitly support drawing round caps for such degenerate -// paths. So this should work perfectly for the case of -// CAIRO_LINE_CAP_ROUND and you'll get the diameter controlled by -// cairo_set_line_width just like you want. } cairo_stroke(cr); } @@ -410,7 +411,7 @@ return; } - ghid_cairo_draw_grid_global(); + ghid_cairo_draw_grid_global(cr); cairo_restore(cr); }