Skip to content

Commit

Permalink
Merge pull request #1285 from gqrx-sdr/drop-clamping-checks
Browse files Browse the repository at this point in the history
Remove unnecessary clamping checks
  • Loading branch information
argilo authored Sep 29, 2023
2 parents af47867 + 117d6a1 commit c97ce74
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2125,11 +2125,8 @@ void CPlotter::drawOverlay()
if (m_CenterLineEnabled)
{
x = xFromFreq(m_CenterFreq);
if (x > 0 && x < w)
{
painter.setPen(QPen(QColor(PLOTTER_CENTER_LINE_COLOR), m_DPR));
painter.drawLine(QPointF(x, 0), QPointF(x, xAxisTop));
}
painter.setPen(QPen(QColor(PLOTTER_CENTER_LINE_COLOR), m_DPR));
painter.drawLine(QPointF(x, 0), QPointF(x, xAxisTop));
}

if (m_MarkersEnabled)
Expand All @@ -2144,35 +2141,31 @@ void CPlotter::drawOverlay()
if (m_MarkerFreqA != MARKER_OFF) {
x = xFromFreq(m_MarkerFreqA);
m_MarkerAX = x;
if (x > 0 && x < w) {
QPolygon poly;
QPainterPath path;
poly << QPoint(x - markerSize/2, 0)
<< QPoint(x + markerSize/2, 0)
<< QPoint(x, markerSize);
path.addPolygon(poly);
painter.drawPolygon(poly);
painter.fillPath(path, brush);
painter.drawLine(x, markerSize, x, xAxisTop);
painter.drawStaticText(QPointF(x + markerSize/2, 0), QStaticText("A"));
}
QPolygon poly;
QPainterPath path;
poly << QPoint(x - markerSize/2, 0)
<< QPoint(x + markerSize/2, 0)
<< QPoint(x, markerSize);
path.addPolygon(poly);
painter.drawPolygon(poly);
painter.fillPath(path, brush);
painter.drawLine(x, markerSize, x, xAxisTop);
painter.drawStaticText(QPointF(x + markerSize/2, 0), QStaticText("A"));
}

if (m_MarkerFreqB != MARKER_OFF) {
x = xFromFreq(m_MarkerFreqB);
m_MarkerBX = x;
if (x > 0 && x < w) {
QPolygon poly;
QPainterPath path;
poly << QPoint(x - markerSize/2, 0)
<< QPoint(x + markerSize/2, 0)
<< QPoint(x, markerSize);
path.addPolygon(poly);
painter.drawPolygon(poly);
painter.fillPath(path, brush);
painter.drawLine(x, markerSize, x, xAxisTop);
painter.drawStaticText(QPointF(x + markerSize/2, 0), QStaticText("B"));
}
QPolygon poly;
QPainterPath path;
poly << QPoint(x - markerSize/2, 0)
<< QPoint(x + markerSize/2, 0)
<< QPoint(x, markerSize);
path.addPolygon(poly);
painter.drawPolygon(poly);
painter.fillPath(path, brush);
painter.drawLine(x, markerSize, x, xAxisTop);
painter.drawStaticText(QPointF(x + markerSize/2, 0), QStaticText("B"));
}
}

Expand Down

0 comments on commit c97ce74

Please sign in to comment.