From c42fe2f5a2b19c50f71730c5b56653ae926fbac5 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 20 Aug 2016 22:13:59 -0300 Subject: [PATCH] eeshow/kicad/dwg.c (dwg_line): use common direction, to avoid false pixel diffs --- eeshow/kicad/dwg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eeshow/kicad/dwg.c b/eeshow/kicad/dwg.c index 282c1f6..261d0c3 100644 --- a/eeshow/kicad/dwg.c +++ b/eeshow/kicad/dwg.c @@ -462,11 +462,18 @@ void dwg_noconn(int x, int y) /* * We can't use gfx_poly because lines are dashed and we don't have that * property at the gfx_poly API. + * + * Since dashing may produce different results between going from A to B and + * going from B to A, we enforce a common direction, so that pixel diffs will + * treat reversed lines as still equal. */ void dwg_line(int sx, int sy, int ex, int ey) { - gfx_line(sx, sy, ex, ey, COLOR_SHEET_DWG, LAYER_LINES); + if (sx < ex || (sx == ex && sy < ey)) + gfx_line(sx, sy, ex, ey, COLOR_SHEET_DWG, LAYER_LINES); + else + gfx_line(ex, ey, sx, sy, COLOR_SHEET_DWG, LAYER_LINES); }