From 9c52c583d743e36daa12ddc8c6854764785fd69f Mon Sep 17 00:00:00 2001 From: Clayton Smith Date: Thu, 28 Sep 2023 22:58:07 -0400 Subject: [PATCH] Add back clamping in band plan coordinate calculation It was inadvertently removed in https://github.com/gqrx-sdr/gqrx/pull/1248. --- src/qtgui/plotter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qtgui/plotter.cpp b/src/qtgui/plotter.cpp index 66a091f87..7894794e9 100644 --- a/src/qtgui/plotter.cpp +++ b/src/qtgui/plotter.cpp @@ -2109,8 +2109,8 @@ void CPlotter::drawOverlay() m_BandPlanHeight = metrics.height() + VER_MARGIN; for (auto & band : bands) { - int band_left = xFromFreq(band.minFrequency); - int band_right = xFromFreq(band.maxFrequency); + int band_left = std::max(xFromFreq(band.minFrequency), 0); + int band_right = std::min(xFromFreq(band.maxFrequency), (int)w); int band_width = band_right - band_left; QRectF rect(band_left, xAxisTop - m_BandPlanHeight, band_width, m_BandPlanHeight); painter.fillRect(rect, band.color);