diff --git a/src/widgets/GraphView.cpp b/src/widgets/GraphView.cpp index 2aa66a9f34..e7c6ba1185 100644 --- a/src/widgets/GraphView.cpp +++ b/src/widgets/GraphView.cpp @@ -349,13 +349,16 @@ void GraphView::paint(QPainter &p, QPoint offset, QRect viewport, qreal scale, b p.setBrush(Qt::gray); - // Always draw edges - // TODO: Only draw edges if they are actually visible ... // Draw edges for (GraphEdge &edge : block.edges) { if (edge.polyline.empty()) { continue; } + // Skips expensive polyline and arrow rendering if the edge's bounding box + // is completely outside the current viewport. + if (!edge.polyline.boundingRect().adjusted(-1, -1, 1, 1).intersects(windowF)) { + continue; + } const QPolygonF polyline = edge.polyline; const EdgeConfiguration ec = edgeConfiguration(block, &blocks[edge.target], interactive);