diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/module.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c index 8aa79f7..b4357a1 100644 --- a/src/module.c +++ b/src/module.c @@ -164,7 +164,19 @@ measure(GanvModule* module, Metrics* m) m->input_width = ganv_module_get_empty_port_breadth(module); m->output_width = ganv_module_get_empty_port_breadth(module); - const double ports_width = PAD + ((m->input_width + PAD) * impl->ports->len); + // TODO: cache this or merge with resize_right + unsigned n_inputs = 0; + unsigned n_outputs = 0; + FOREACH_PORT(impl->ports, pi) { + if ((*pi)->impl->is_input) { + ++n_inputs; + } else { + ++n_outputs; + } + } + + const double ports_width = PAD + ((m->input_width + PAD) * + MAX(n_inputs, n_outputs)); m->width = MAX(contents_width, ports_width); m->width = MAX(m->width, impl->embed_width); |