|
10 | 10 | #include <QPolygon> |
11 | 11 | #include <algorithm> |
12 | 12 | #include <cmath> |
| 13 | +#include <cstdint> |
13 | 14 | #include <exception> |
14 | 15 | #include <iterator> |
15 | 16 | #include <mutex> |
@@ -1552,18 +1553,14 @@ void RenderThread::setupIOPins(odb::dbBlock* block, const odb::Rect& bounds) |
1552 | 1553 | } |
1553 | 1554 |
|
1554 | 1555 | const auto die_area = block->getDieArea(); |
1555 | | - const auto die_width = die_area.dx(); |
1556 | | - const auto die_height = die_area.dy(); |
1557 | 1556 |
|
1558 | 1557 | pin_draw_names_ = viewer_->options_->areIOPinNamesVisible(); |
| 1558 | + const double scale_factor |
| 1559 | + = 0.02; // 4 Percent of bounds is used to draw pin-markers |
| 1560 | + const int die_max_dim = std::min(die_area.maxDXDY(), bounds.maxDXDY()); |
| 1561 | + const double abs_min_dim = 8.0; // prevent markers from falling apart |
| 1562 | + pin_max_size_ = std::max(scale_factor * die_max_dim, abs_min_dim); |
1559 | 1563 | if (pin_draw_names_) { |
1560 | | - const double scale_factor |
1561 | | - = 0.02; // 4 Percent of bounds is used to draw pin-markers |
1562 | | - const int die_max_dim |
1563 | | - = std::min(std::max(die_width, die_height), bounds.maxDXDY()); |
1564 | | - const double abs_min_dim = 8.0; // prevent markers from falling apart |
1565 | | - pin_max_size_ = std::max(scale_factor * die_max_dim, abs_min_dim); |
1566 | | - |
1567 | 1564 | pin_font_ = viewer_->options_->ioPinMarkersFont(); |
1568 | 1565 | const QFontMetrics font_metrics(pin_font_); |
1569 | 1566 |
|
@@ -1690,16 +1687,33 @@ void RenderThread::drawIOPins(Painter& painter, |
1690 | 1687 | }; |
1691 | 1688 | std::vector<PinText> pin_text_spec; |
1692 | 1689 |
|
| 1690 | + const int min_bpin_size = viewer_->options_->isDetailedVisibility() |
| 1691 | + ? viewer_->fineViewableResolution() |
| 1692 | + : viewer_->nominalViewableResolution(); |
| 1693 | + const int64_t max_lin_bpins = bounds.minDXDY() / min_bpin_size; |
| 1694 | + const int64_t max_bpins |
| 1695 | + = std::min(kMaxBPinsPerLayer, max_lin_bpins * max_lin_bpins); |
| 1696 | + |
1693 | 1697 | painter.setPen(layer); |
1694 | 1698 | painter.setBrush(layer); |
1695 | 1699 |
|
| 1700 | + auto bpins = viewer_->search_.searchBPins( |
| 1701 | + block, layer, bounds.xMin(), bounds.yMin(), bounds.xMax(), bounds.yMax()); |
| 1702 | + debugPrint(logger_, |
| 1703 | + GUI, |
| 1704 | + "draw", |
| 1705 | + 2, |
| 1706 | + "found {} bpins on layer {}, drawing limit {} ({}) bpins", |
| 1707 | + bpins.size(), |
| 1708 | + layer->getName(), |
| 1709 | + max_bpins, |
| 1710 | + max_lin_bpins); |
| 1711 | + if (bpins.size() > max_bpins) { |
| 1712 | + return; |
| 1713 | + } |
| 1714 | + |
1696 | 1715 | std::vector<odb::Rect> pin_text_spec_shape_rects; |
1697 | | - for (const auto& [box, pin] : viewer_->search_.searchBPins(block, |
1698 | | - layer, |
1699 | | - bounds.xMin(), |
1700 | | - bounds.yMin(), |
1701 | | - bounds.xMax(), |
1702 | | - bounds.yMax())) { |
| 1716 | + for (const auto& [box, pin] : bpins) { |
1703 | 1717 | if (restart_) { |
1704 | 1718 | break; |
1705 | 1719 | } |
|
0 commit comments