From: yu.dongliang <18588496441@163.com> Date: Thu, 13 Jul 2023 09:19:57 +0000 (+0800) Subject: draw R X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=8902a9ed57ddb3d38e57ed4676f1c03781f0f761;p=ses.git draw R --- diff --git a/ses_layout.c b/ses_layout.c index fa1ed30..474ef09 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -646,8 +646,8 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ cairo_line_to(cr, p->x, p->y); } else { - cairo_move_to(cr, c->x - 7, c->y + 5); - cairo_line_to(cr, c->x + 7, c->y + 5); + cairo_move_to(cr, c->x - 8, c->y + 5); + cairo_line_to(cr, c->x + 8, c->y + 5); cairo_move_to(cr, c->x, c->y + 5); cairo_line_to(cr, p->x, p->y); @@ -665,44 +665,21 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ case SCF_EDA_Resistor: p = c->pins[0]; - vertical(&dx0, &dy0, c->x - p->x, c->y - p->y, 3); - vertical(&dx1, &dy1, c->x - p->x, c->y - p->y, -6); - vertical(&dx2, &dy2, c->x - p->x, c->y - p->y, 6); - - forward (&dx3, &dy3, c->x - p->x, c->y - p->y, -12); - forward (&dx4, &dy4, c->x - p->x, c->y - p->y, 12); - - scf_logw("dx0: %d, dy0: %d\n", dx0, dy0); - scf_logw("dx1: %d, dy1: %d\n", dx1, dy1); - scf_logw("dx2: %d, dy2: %d\n", dx2, dy2); - scf_logw("dx3: %d, dy3: %d\n", dx3, dy3); - scf_logw("dx4: %d, dy4: %d\n", dx4, dy4); - - cairo_move_to (cr, c->x, c->y); - cairo_rel_move_to(cr, dx0, dy0); - cairo_rel_line_to(cr, dx1, dy1); - cairo_rel_line_to(cr, dx4, dy4); - cairo_rel_line_to(cr, dx2, dy2); - cairo_rel_line_to(cr, dx3, dy3); - - if (p->y < c->y) { - cairo_move_to(cr, c->x, c->y); - cairo_line_to(cr, p->x, p->y); + vertical(&dx0, &dy0, c->x - p->x, c->y - p->y, 3); + forward (&dx1, &dy1, c->x - p->x, c->y - p->y, 6); - p = c->pins[1]; - cairo_move_to(cr, c->x, c->y); - cairo_rel_move_to(cr, dx4, dy4); - cairo_line_to(cr, p->x, p->y); - } else { - cairo_move_to(cr, c->x, c->y); - cairo_rel_move_to(cr, dx4, dy4); - cairo_line_to(cr, p->x, p->y); + cairo_move_to (cr, p->x, p->y); + cairo_line_to (cr, c->x - dx1, c->y - dy1); - p = c->pins[1]; - cairo_move_to(cr, c->x, c->y); - cairo_line_to(cr, p->x, p->y); - } + cairo_rel_move_to(cr, dx0, dy0); + cairo_rel_line_to(cr, -dx0 * 2, -dy0 * 2); + cairo_rel_line_to(cr, dx1 * 2, dy1 * 2); + cairo_rel_line_to(cr, dx0 * 2, dy0 * 2); + cairo_rel_line_to(cr, -dx1 * 2, -dy1 * 2); + p = c->pins[1]; + cairo_move_to (cr, p->x, p->y); + cairo_line_to (cr, c->x + dx1, c->y + dy1); break; case SCF_EDA_Diode: