draw Diode
authoryu.dongliang <18588496441@163.com>
Thu, 13 Jul 2023 09:47:43 +0000 (17:47 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 13 Jul 2023 09:47:50 +0000 (17:47 +0800)
ses_layout.c

index 474ef09c88028161871d74695f562f528259c720..1ba003a264debe1e12dd892072957c845abe05f7 100644 (file)
@@ -686,21 +686,22 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_
                                        p = c->pins[SCF_EDA_Diode_POS];
 
                                        vertical(&dx0, &dy0, c->x - p->x, c->y - p->y,  6);
-                                       vertical(&dx1, &dy1, c->x - p->x, c->y - p->y, -6);
-                                       vertical(&dx2, &dy2, c->x - p->x, c->y - p->y, -12);
-                                       forward (&dx3, &dy3, c->x - p->x, c->y - p->y,  12);
+                                       forward (&dx1, &dy1, c->x - p->x, c->y - p->y,  6);
 
-                                       cairo_move_to(cr, p->x, p->y);
-                                       cairo_line_to(cr, c->x, c->y);
+                                       cairo_move_to(cr, p->x,       p->y);
+                                       cairo_line_to(cr, c->x - dx1, c->y - dy1);
 
-                                       cairo_rel_move_to(cr, dx0,  dy0);
-                                       cairo_rel_line_to(cr, dx2,  dy2);
-                                       cairo_line_to    (cr, c->x + dx3, c->y + dy3);
-                                       cairo_line_to    (cr, c->x + dx0, c->y + dy0);
+                                       cairo_rel_move_to(cr,  dx0,              dy0);
+                                       cairo_rel_line_to(cr, -dx0 * 2,         -dy0 * 2);
+                                       cairo_line_to    (cr,  c->x + dx1,       c->y + dy1);
+                                       cairo_line_to    (cr,  c->x + dx0 - dx1, c->y + dy0 - dy1);
 
                                        p = c->pins[SCF_EDA_Diode_NEG];
-                                       cairo_move_to(cr, c->x + dx3, c->y + dy3);
-                                       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);
+                                       cairo_rel_move_to(cr,  dx0,         dy0);
+                                       cairo_rel_line_to(cr, -dx0 * 2,    -dy0 * 2);
                                        break;
 
                                case SCF_EDA_Transistor: