Skip to content
Merged
Changes from all commits
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
65 changes: 42 additions & 23 deletions sdrgui/gui/glspectrumview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,19 +1140,6 @@ void GLSpectrumView::paintGL()
}
}
}

// draw rect around
{
GLfloat q3[] {
1, 1,
0, 1,
0, 0,
1, 0
};

QVector4D color(1.0f, 1.0f, 1.0f, 0.5f);
m_glShaderSimple.drawContour(m_glHistogramBoxMatrix, color, q3, 4);
}
}

// paint left scales (time and power)
Expand Down Expand Up @@ -1342,9 +1329,14 @@ void GLSpectrumView::paintGL()
q3[4*i+2] = (GLfloat)i;
q3[4*i+3] = v;
}
// Replicate Nyquist sample to end of positive side
q3[4*m_nbBins] = (GLfloat) m_nbBins;
q3[4*m_nbBins+1] = q3[1];
q3[4*m_nbBins+2] = (GLfloat) m_nbBins;
q3[4*m_nbBins+3] = q3[3];

QVector4D color(0.5f, 0.0f, 0.0f, (float) m_displayTraceIntensity / 100.0f);
m_glShaderSimple.drawSurfaceStrip(m_glHistogramSpectrumMatrix, color, q3, 2*m_nbBins);
m_glShaderSimple.drawSurfaceStrip(m_glHistogramSpectrumMatrix, color, q3, 2*(m_nbBins+1));
}
// Max hold line
{
Expand All @@ -1363,9 +1355,12 @@ void GLSpectrumView::paintGL()
q3[2*i] = (Real) i;
q3[2*i+1] = v;
}
// Replicate Nyquist sample to end of positive side
q3[2*m_nbBins] = (GLfloat) m_nbBins;
q3[2*m_nbBins+1] = q3[1];

QVector4D color(1.0f, 0.0f, 0.0f, (float) m_displayTraceIntensity / 100.0f);
m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_nbBins);
m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_nbBins+1);
}
}

Expand Down Expand Up @@ -1394,12 +1389,17 @@ void GLSpectrumView::paintGL()
q3[4*i+2] = (GLfloat)i;
q3[4*i+3] = v;
}
// Replicate Nyquist sample to end of positive side
q3[4*m_nbBins] = (GLfloat) m_nbBins;
q3[4*m_nbBins+1] = q3[1];
q3[4*m_nbBins+2] = (GLfloat) m_nbBins;
q3[4*m_nbBins+3] = q3[3];

QVector4D color(1.0f, 1.0f, 0.25f, (float) m_displayTraceIntensity / 100.0f);
if (m_spectrumStyle == SpectrumSettings::Gradient) {
m_glShaderColorMap.drawSurfaceStrip(m_glHistogramSpectrumMatrix, q3, 2*m_nbBins, bottom, 0.75f);
m_glShaderColorMap.drawSurfaceStrip(m_glHistogramSpectrumMatrix, q3, 2*(m_nbBins+1), bottom, 0.75f);
} else {
m_glShaderSimple.drawSurfaceStrip(m_glHistogramSpectrumMatrix, color, q3, 2*m_nbBins);
m_glShaderSimple.drawSurfaceStrip(m_glHistogramSpectrumMatrix, color, q3, 2*(m_nbBins+1));
}
}

Expand Down Expand Up @@ -1427,14 +1427,17 @@ void GLSpectrumView::paintGL()
m_peakFinder.push(m_currentSpectrum[i], i == m_nbBins - 1);
}
}
// Replicate Nyquist sample to end of positive side
q3[2*m_nbBins] = (GLfloat) m_nbBins;
q3[2*m_nbBins+1] = q3[1];

QVector4D color;
if (m_spectrumStyle == SpectrumSettings::Gradient) {
color = QVector4D(m_colorMap[255*3], m_colorMap[255*3+1], m_colorMap[255*3+2], (float) m_displayTraceIntensity / 100.0f);
} else {
color = QVector4D(1.0f, 1.0f, 0.25f, (float) m_displayTraceIntensity / 100.0f);
}
m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_nbBins);
m_glShaderSimple.drawPolyline(m_glHistogramSpectrumMatrix, color, q3, m_nbBins+1);

if (m_histogramFindPeaks) {
m_peakFinder.sortPeaks();
Expand Down Expand Up @@ -1701,6 +1704,22 @@ void GLSpectrumView::paintGL()
}
}

// paint rect around histogram (do last, so on top of filled spectrum)
if (m_displayHistogram || m_displayMaxHold || m_displayCurrent)
{
{
GLfloat q3[] {
1, 1,
0, 1,
0, 0,
1, 0
};

QVector4D color(1.0f, 1.0f, 1.0f, 0.5f);
m_glShaderSimple.drawContour(m_glHistogramBoxMatrix, color, q3, 4);
}
}

// Paint info line
{
GLfloat vtx1[] = {
Expand Down Expand Up @@ -2597,7 +2616,7 @@ void GLSpectrumView::applyChanges()
1.0f - ((float)(2*histogramTop) / (float) height())
);
m_glHistogramSpectrumMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins - 1)),
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)),
((float) 2*m_histogramHeight / height()) / m_powerRange
);

Expand Down Expand Up @@ -2726,7 +2745,7 @@ void GLSpectrumView::applyChanges()
1.0f - ((float)(2*histogramTop) / (float) height())
);
m_glHistogramSpectrumMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins - 1)),
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)),
((float) 2*(height() - m_topMargin - m_frequencyScaleHeight)) / (height()*m_powerRange)
);

Expand Down Expand Up @@ -3243,10 +3262,10 @@ void GLSpectrumView::applyChanges()
m_histogram = new quint8[100 * m_nbBins];
memset(m_histogram, 0x00, 100 * m_nbBins);

m_q3FFT.allocate(2*m_nbBins);
m_q3FFT.allocate(2*(m_nbBins+1));

m_q3ColorMap.allocate(4*m_nbBins);
std::fill(m_q3ColorMap.m_array, m_q3ColorMap.m_array+4*m_nbBins, 0.0f);
m_q3ColorMap.allocate(4*(m_nbBins+1));
std::fill(m_q3ColorMap.m_array, m_q3ColorMap.m_array+4*(m_nbBins+1), 0.0f);
}

if (fftSizeChanged || windowSizeChanged)
Expand Down