Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 16991) +++ trunk/src/crosshair.c (revision 16992) @@ -89,7 +89,7 @@ if (dash_last) { pcb_draw_dashed_line(pcb_crosshair.GC, polygon->Points[i].X + dx, - polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); + polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy, 5); break; /* skip normal line draw below */ } } Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 16991) +++ trunk/src/draw.c (revision 16992) @@ -108,14 +108,15 @@ pcb_snprintf(buf, sizeof("#XXXXXX"), "#%02x%02x%02x", r, g, b); } -void pcb_draw_dashed_line(pcb_hid_gc_t GC, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +void pcb_draw_dashed_line(pcb_hid_gc_t GC, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, unsigned int segs) { /* TODO: we need a real geo lib... using double here is plain wrong */ double dx = x2-x1, dy = y2-y1; double len_squared = dx*dx + dy*dy; int n; - const int segs = 11; /* must be odd */ + segs = (segs << 1) + 1; /* must be odd */ + if (len_squared < 1000000) { /* line too short, just draw it - TODO: magic value; with a proper geo lib this would be gone anyway */ pcb_gui->draw_line(GC, x1, y1, x2, y2); Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 16991) +++ trunk/src/draw.h (revision 16992) @@ -73,9 +73,13 @@ extern pcb_bool pcb_draw_doing_assy; void pcb_lighten_color(const char *orig, char buf[8], double factor); -void pcb_draw_dashed_line(pcb_hid_gc_t GC, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2); +/* Draw a series of short line segments emulating a dashed line. segs is + the number of on/off segment pairs. It is guaranteed that the line starts + and ends with an "on" line segment */ +void pcb_draw_dashed_line(pcb_hid_gc_t GC, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, unsigned int segs); + void pcb_draw(void); void pcb_redraw(void); void pcb_draw_obj(pcb_any_obj_t *obj); Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 16991) +++ trunk/src/obj_subc.c (revision 16992) @@ -1530,10 +1530,10 @@ pcb_gui->set_line_width(pcb_draw_out.fgGC, 0); pcb_gui->set_draw_xor(pcb_draw_out.fgGC, 1); - pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X1, bb->Y1, bb->X2, bb->Y1); - pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X1, bb->Y1, bb->X1, bb->Y2); - pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X2, bb->Y2, bb->X2, bb->Y1); - pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X2, bb->Y2, bb->X1, bb->Y2); + pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X1, bb->Y1, bb->X2, bb->Y1, 5); + pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X1, bb->Y1, bb->X1, bb->Y2, 5); + pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X2, bb->Y2, bb->X2, bb->Y1, 5); + pcb_draw_dashed_line(pcb_draw_out.fgGC, bb->X2, bb->Y2, bb->X1, bb->Y2, 5); pcb_gui->set_draw_xor(pcb_draw_out.fgGC, 0); if (subc->refdes != NULL) {