From: yu.dongliang <18588496441@163.com> Date: Sun, 5 Nov 2023 09:03:41 +0000 (+0800) Subject: ses_layout_draw() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=63db96cc1427155534f45508e0dbb1815ee28528;p=ses.git ses_layout_draw() --- diff --git a/ses_layout.c b/ses_layout.c index dab4a9a..c19aafe 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -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); } }