tmp
authoryu.dongliang <18588496441@163.com>
Sun, 9 Jul 2023 16:45:56 +0000 (00:45 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 9 Jul 2023 16:45:56 +0000 (00:45 +0800)
ses_layout.c

index ee54a776829537a83181b550d9c85d2dc4844055..e46bba4893ea43e943283708ef7f8376d03a49b2 100644 (file)
@@ -238,6 +238,7 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u
        ScfEline* el2;
        ScfEconn* ec;
        ScfLine*  l;
+       ScfLine*  l2;
 
        uint32_t  w;
        uint32_t  h;
@@ -297,6 +298,50 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u
 
                n += m;
        }
+       scf_logi("f->x: %d, f->y: %d, f->w: %d, f->h: %d\n", f->x, f->y, f->w, f->h);
+
+       for (i = 0; i < f->n_elines; i++) {
+               el =        f->elines[i];
+
+               uint32_t sum = 0;
+
+               for (j = 0; j < el->n_conns; j++) {
+                       ec =        el->conns[j];
+
+                       el2 = NULL;
+                       for (k = 0; k < f->n_elines; k++) {
+                               el2       = f->elines[k];
+
+                               if (el2->id == ec->lid)
+                                       break;
+                       }
+
+                       assert(k < f->n_elines);
+                       uint32_t dis = UINT_MAX;
+
+                       for (k = 0; k < el->n_lines; k++) {
+                               l  =        el->lines[k];
+
+                               for (m = 0; m < el2->n_lines; m++) {
+                                       l2 =        el2->lines[m];
+
+                                       uint32_t dis2;
+
+                                       if (l->y0 < l2->y0)
+                                               dis2  = l2->y0 - l->y0;
+                                       else
+                                               dis2  = l->y0 - l2->y0;
+
+                                       if (dis > dis2)
+                                               dis = dis2;
+                               }
+                       }
+
+                       sum += dis;
+               }
+
+               scf_logi("el->id: %ld, sum: %d\n", el->id, sum);
+       }
 
        return 0;
 }