Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Optimize the way the frame marker is rendered over the static graph d…
…ata to drastically reduce the plot time when seeking in ld-analyse.
  • Loading branch information
simoninns committed Dec 7, 2025
commit 3dc75d20bf0d56275876398a872376095ddab2db
22 changes: 21 additions & 1 deletion tools/ld-analyse/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ void PlotMarker::setPen(const QPen &pen)

void PlotMarker::setPosition(const QPointF &pos)
{
prepareGeometryChange();
m_dataPos = pos;
update();
}
Expand All @@ -552,7 +553,26 @@ void PlotMarker::setLabel(const QString &label)

QRectF PlotMarker::boundingRect() const
{
return m_plotRect;
if (!m_plotWidget || m_plotRect.isEmpty()) return QRectF();

QPointF scenePos = m_plotWidget->mapFromData(m_dataPos);

// Only return the actual area occupied by the marker line (plus small margin)
// This prevents unnecessary repainting of the entire plot
const qreal margin = 2.0;

switch (m_style) {
case VLine:
return QRectF(scenePos.x() - margin, m_plotRect.top(),
margin * 2, m_plotRect.height());
case HLine:
return QRectF(m_plotRect.left(), scenePos.y() - margin,
m_plotRect.width(), margin * 2);
case Cross:
return m_plotRect; // Cross needs full area
}

return QRectF();
}

void PlotMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Expand Down