tmp
authoryu.dongliang <18588496441@163.com>
Mon, 10 Jul 2023 15:27:08 +0000 (23:27 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 10 Jul 2023 15:27:08 +0000 (23:27 +0800)
ses_layout.c

index 84f77f4f438d3a88a3f8f24837e8613f14449c31..14b2e20ebb0bdfb461a920575b4228b25935b402 100644 (file)
@@ -303,10 +303,23 @@ int __ses_layout_function(ScfEfunction* f, ScfEline* el, size_t* pn, uint32_t d,
 
                        if (el2->id == ec->lid && 0 == el2->n_lines) {
 
+                               int diff = 5 + rand() % 10;
+
+                               bx += diff;
+                               bw -= diff;
+
                                ret = __ses_layout_function(f, el2, pn, d, bx, by, bw, bh);
                                if (ret < 0)
                                        return ret;
 
+                               if (i == el->n_conns / 2) {
+                                       uint32_t tmp      = el ->lines[0]->y0;
+                                       el ->lines[0]->y0 = el2->lines[0]->y0;
+                                       el2->lines[0]->y0 = tmp;
+
+                                       el ->lines[0]->y1 = el ->lines[0]->y0;
+                                       el2->lines[0]->y1 = el2->lines[0]->y0;
+                               }
                                break;
                        }
                }
@@ -345,6 +358,11 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u
                        int ret = __ses_layout_function(f, el, &n, d, bx, by, bw, bh);
                        if (ret < 0)
                                return ret;
+
+                       int diff = 5 + rand() % 10;
+
+                       bx += diff;
+                       bw -= diff;
                }
        }
        scf_logi("f->x: %d, f->y: %d, f->w: %d, f->h: %d\n", f->x, f->y, f->w, f->h);
@@ -380,7 +398,7 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u
                        m = j * d % f->w;
                        assert(m < l->x1);
 
-                       p->x = l->x1 - m;
+                       p->x = l->x0 + m;
                        p->y = l->y0;
                }
        }