From a1e2f541daa34a435951a8e22ddcc93c2f24f323 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 2 Mar 2016 09:16:21 +0100 Subject: [PATCH] OpenGL modernization: draw the spectrum line in the new way. Rectangle calculation update. --- sdrbase/gui/glspectrum.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index 575042539..dc52144da 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -1247,9 +1247,9 @@ void GLSpectrum::paintGL() QMatrix4x4 tsMatrix; tsMatrix.setToIdentity(); //qDebug("GLSpectrum::paintGL: %f %f %f %f", m_glHistogramRect.x(), m_glHistogramRect.y(), m_glHistogramRect.width(), m_glHistogramRect.height()); - //tsMatrix.translate(m_glHistogramRect.x(), m_glHistogramRect.y(), 0); tsMatrix.translate(m_glHistogramRect2.x(), m_glHistogramRect2.y(), 0); - tsMatrix.scale((2.0f * m_glHistogramRect.width()) / (float)(m_fftSize - 1), (2.0f * m_glHistogramRect.height()) / m_powerRange, 1); + //tsMatrix.scale((2.0f * m_glHistogramRect.width()) / (float)(m_fftSize - 1), m_glHistogramRect2.height() / m_powerRange, 1); + tsMatrix.scale((2.0f * m_glHistogramRect.width()) / (float)(m_fftSize - 1), m_glHistogramRect2.height() / m_powerRange, 1); m_program->setUniformValue(m_matrixLoc, tsMatrix); m_program->setUniformValue(m_colorLoc, color); f->glEnable(GL_BLEND); @@ -1592,7 +1592,7 @@ void GLSpectrum::applyChanges() m_glHistogramRect2 = QRectF( -1.0f + ((float)leftMargin / width2), 1.0f - ((float)histogramTop / height2), - 1.0f - ((float)(width2 - leftMargin - rightMargin) / width2), + -1.0f + (((float) (width() - leftMargin - rightMargin)) / width2), 1.0f - ((float)histogramHeight / height2) );