qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
- int mx = 0;
-
for (i = 0; i < f->n_components - 1; i++) {
c0 = f->components[i];
if (y0 < y2 && y2 < y1 && y1 < y3) {
- if (p0->x > 0) {
+ if (p0->x > 0)
p0->x = -p0->x;
- if (mx > p0->x)
- mx = p0->x;
- }
- if (p1->x > 0) {
+ if (p1->x > 0)
p1->x = -p1->x;
- if (mx > p1->x)
- mx = p1->x;
- }
} else if (y2 < y0 && y0 < y3 && y3 < y1) {
- if (p2->x > 0) {
+ if (p2->x > 0)
p2->x = -p2->x;
- if (mx > p2->x)
- mx = p2->x;
- }
- if (p3->x > 0) {
+ if (p3->x > 0)
p3->x = -p3->x;
- if (mx > p3->x)
- mx = p3->x;
- }
}
}
}
c0 = NULL;
}
+ int mx = 0;
+ int nx = INT_MIN;
+ int px = INT_MAX;
+
+ for (i = 0; i < f->n_components; i++) {
+ c0 = f->components[i];
+
+ for (j = 0; j < c0->n_pins; j++) {
+ p0 = c0->pins[j];
+
+ if (p0->x < 0) {
+ if (mx > p0->x)
+ mx = p0->x;
+
+ if (nx < p0->x)
+ nx = p0->x;
+
+ } else {
+ if (px > p0->x)
+ px = p0->x;
+ }
+ }
+ }
+
+ if (INT_MIN == nx)
+ nx = 0;
+
+ if (INT_MAX == px)
+ px = 0;
+
+ scf_loge("mx: %d, nx: %d, px: %d\n", mx, nx, px);
+
for (i = 0; i < f->n_components; i++) {
c0 = f->components[i];
for (j = 0; j < c0->n_pins; j++) {
p0 = c0->pins[j];
+ if (p0->x > 0)
+ p0->x -= px - nx - d;
+
p0->x -= mx - d;
if (j < 2) {
el0->lines[0]->x1 = x1;
}
- f->w -= mx - d * 2;
+ f->w -= mx - 3 * d + px - nx;
f->h += d;
scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h);