ses_layout_draw()
authoryu.dongliang <18588496441@163.com>
Sun, 5 Nov 2023 09:03:41 +0000 (17:03 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 5 Nov 2023 09:03:41 +0000 (17:03 +0800)
ses_layout.c

index dab4a9ab93d2178228d06a3bb149fcc5e8101925..c19aafe38d5aefbc522ef4fb65e9f015fc4307e2 100644 (file)
@@ -1350,6 +1350,11 @@ int ses_layout_function(ScfEfunction* f, int d)
        for (i = 0; i < f->n_elines; i++) {
                el        = f->elines[i];
 
+               for (j = 0; j < el->n_lines; j++) {
+                       el->lines[j]->x0 = INT_MAX;
+                       el->lines[j]->x1 = 0;
+               }
+
                for (j = 0; j < el->n_pins; j += 2) {
 
                        c  = f->components[el->pins[j]];
@@ -1438,21 +1443,22 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_
                                cairo_set_line_width(cr, 2);
                        }
 
+                       uint8_t text[64];
+                       snprintf(text, sizeof(text) - 1, "%ld", el->id);
+
+                       cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                       cairo_set_font_size   (cr, 24);
+
                        for (k = 0; k < el->n_lines; k++) {
                                l  =        el->lines[k];
 
+                               cairo_move_to  (cr, l->x0 - 20, l->y0 + 5);
+                               cairo_show_text(cr, text);
+
                                cairo_move_to(cr, l->x0, l->y0);
                                cairo_line_to(cr, l->x1, l->y1);
                        }
 
-                       uint8_t text[64];
-                       snprintf(text, sizeof(text) - 1, "%ld", el->id);
-
-                       cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-                       cairo_set_font_size   (cr, 24);
-                       cairo_move_to         (cr, l->x0 - 20, l->y0 + 5);
-                       cairo_show_text       (cr, text);
-
                        cairo_stroke(cr);
                }
        }