mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
TVScren: removed clanup() call from destructot. Some code cleanup
This commit is contained in:
parent
dbe3892d52
commit
a08e18b505
@ -16,6 +16,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <gui/glshadertvarray.h>
|
||||
|
||||
const QString GLShaderTVArray::m_strVertexShaderSourceArray = QString(
|
||||
@ -39,24 +40,24 @@ GLShaderTVArray::GLShaderTVArray(bool blnColor) : m_blnColor(blnColor)
|
||||
{
|
||||
m_blnAlphaBlend = false;
|
||||
m_blnAlphaReset = false;
|
||||
m_objProgram = 0;
|
||||
m_objImage = 0;
|
||||
m_objTexture = 0;
|
||||
m_objProgram = nullptr;
|
||||
m_objImage = nullptr;
|
||||
m_objTexture = nullptr;
|
||||
m_intCols = 0;
|
||||
m_intRows = 0;
|
||||
m_blnInitialized = false;
|
||||
m_objCurrentRow = 0;
|
||||
m_objCurrentRow = nullptr;
|
||||
|
||||
m_objTextureLoc = 0;
|
||||
m_objMatrixLoc = 0;
|
||||
m_textureLoc = 0;
|
||||
m_matrixLoc = 0;
|
||||
}
|
||||
|
||||
GLShaderTVArray::~GLShaderTVArray()
|
||||
{
|
||||
Cleanup();
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void GLShaderTVArray::InitializeGL(int intCols, int intRows)
|
||||
void GLShaderTVArray::initializeGL(int intCols, int intRows)
|
||||
{
|
||||
QMatrix4x4 objQMatrix;
|
||||
|
||||
@ -65,9 +66,9 @@ void GLShaderTVArray::InitializeGL(int intCols, int intRows)
|
||||
m_intCols = 0;
|
||||
m_intRows = 0;
|
||||
|
||||
m_objCurrentRow = 0;
|
||||
m_objCurrentRow = nullptr;
|
||||
|
||||
if (m_objProgram == 0)
|
||||
if (!m_objProgram)
|
||||
{
|
||||
m_objProgram = new QOpenGLShaderProgram();
|
||||
|
||||
@ -95,18 +96,18 @@ void GLShaderTVArray::InitializeGL(int intCols, int intRows)
|
||||
}
|
||||
|
||||
m_objProgram->bind();
|
||||
m_objProgram->setUniformValue(m_objMatrixLoc, objQMatrix);
|
||||
m_objProgram->setUniformValue(m_objTextureLoc, 0);
|
||||
m_objProgram->setUniformValue(m_matrixLoc, objQMatrix);
|
||||
m_objProgram->setUniformValue(m_textureLoc, 0);
|
||||
m_objProgram->release();
|
||||
}
|
||||
|
||||
m_objMatrixLoc = m_objProgram->uniformLocation("uMatrix");
|
||||
m_objTextureLoc = m_objProgram->uniformLocation("uTexture");
|
||||
m_matrixLoc = m_objProgram->uniformLocation("uMatrix");
|
||||
m_textureLoc = m_objProgram->uniformLocation("uTexture");
|
||||
|
||||
if (m_objTexture != 0)
|
||||
if (m_objTexture)
|
||||
{
|
||||
delete m_objTexture;
|
||||
m_objTexture = 0;
|
||||
m_objTexture = nullptr;
|
||||
}
|
||||
|
||||
//Image container
|
||||
@ -133,7 +134,7 @@ QRgb * GLShaderTVArray::GetRowBuffer(int intRow)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_objImage == 0)
|
||||
if (!m_objImage)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -170,13 +171,11 @@ void GLShaderTVArray::RenderPixels(unsigned char *chrData)
|
||||
QRgb *ptrLine;
|
||||
int intVal;
|
||||
|
||||
if (!m_blnInitialized)
|
||||
{
|
||||
if (!m_blnInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_objImage == 0)
|
||||
{
|
||||
if (m_objImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -210,18 +209,22 @@ void GLShaderTVArray::RenderPixels(unsigned char *chrData)
|
||||
|
||||
m_objProgram->bind();
|
||||
|
||||
m_objProgram->setUniformValue(m_objMatrixLoc, objQMatrix);
|
||||
m_objProgram->setUniformValue(m_objTextureLoc, 0);
|
||||
m_objProgram->setUniformValue(m_matrixLoc, objQMatrix);
|
||||
m_objProgram->setUniformValue(m_textureLoc, 0);
|
||||
|
||||
if (m_blnAlphaReset) {
|
||||
if (m_blnAlphaReset)
|
||||
{
|
||||
ptrF->glClear(GL_COLOR_BUFFER_BIT);
|
||||
m_blnAlphaReset = false;
|
||||
}
|
||||
|
||||
if (m_blnAlphaBlend) {
|
||||
if (m_blnAlphaBlend)
|
||||
{
|
||||
ptrF->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
ptrF->glEnable(GL_BLEND);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ptrF->glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
@ -250,45 +253,43 @@ void GLShaderTVArray::RenderPixels(unsigned char *chrData)
|
||||
|
||||
void GLShaderTVArray::ResetPixels()
|
||||
{
|
||||
if (m_objImage != 0)
|
||||
{
|
||||
if (m_objImage) {
|
||||
m_objImage->fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
void GLShaderTVArray::ResetPixels(int alpha)
|
||||
{
|
||||
if (m_objImage != 0)
|
||||
{
|
||||
if (m_objImage) {
|
||||
m_objImage->fill(qRgba(0, 0, 0, alpha));
|
||||
}
|
||||
}
|
||||
|
||||
void GLShaderTVArray::Cleanup()
|
||||
void GLShaderTVArray::cleanup()
|
||||
{
|
||||
m_blnInitialized = false;
|
||||
|
||||
m_intCols = 0;
|
||||
m_intRows = 0;
|
||||
|
||||
m_objCurrentRow = 0;
|
||||
m_objCurrentRow = nullptr;
|
||||
|
||||
if (m_objProgram)
|
||||
{
|
||||
delete m_objProgram;
|
||||
m_objProgram = 0;
|
||||
m_objProgram = nullptr;
|
||||
}
|
||||
|
||||
if (m_objTexture != 0)
|
||||
if (m_objTexture)
|
||||
{
|
||||
delete m_objTexture;
|
||||
m_objTexture = 0;
|
||||
m_objTexture = nullptr;
|
||||
}
|
||||
|
||||
if (m_objImage != 0)
|
||||
if (m_objImage)
|
||||
{
|
||||
delete m_objImage;
|
||||
m_objImage = 0;
|
||||
m_objImage = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +306,7 @@ bool GLShaderTVArray::SelectRow(int intLine)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_objCurrentRow = 0;
|
||||
m_objCurrentRow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +319,7 @@ bool GLShaderTVArray::SetDataColor(int intCol, QRgb objColor)
|
||||
|
||||
if (m_blnInitialized)
|
||||
{
|
||||
if ((intCol < m_intCols) && (intCol >= 0) && (m_objCurrentRow != 0))
|
||||
if ((intCol < m_intCols) && (intCol >= 0) && (m_objCurrentRow))
|
||||
{
|
||||
m_objCurrentRow[intCol] = objColor;
|
||||
blnRslt = true;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <QOpenGLFunctions_3_0>
|
||||
#include <QOpenGLTexture>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLContext>
|
||||
#include <QMatrix4x4>
|
||||
#include <QVector4D>
|
||||
#include <QDebug>
|
||||
@ -46,8 +45,8 @@ public:
|
||||
void setColor(bool blnColor) { m_blnColor = blnColor; }
|
||||
void setAlphaBlend(bool blnAlphaBlend) { m_blnAlphaBlend = blnAlphaBlend; }
|
||||
void setAlphaReset() { m_blnAlphaReset = true; }
|
||||
void InitializeGL(int intCols, int intRows);
|
||||
void Cleanup();
|
||||
void initializeGL(int intCols, int intRows);
|
||||
void cleanup();
|
||||
QRgb *GetRowBuffer(int intRow);
|
||||
void RenderPixels(unsigned char *chrData);
|
||||
void ResetPixels();
|
||||
@ -60,8 +59,8 @@ public:
|
||||
protected:
|
||||
|
||||
QOpenGLShaderProgram *m_objProgram;
|
||||
int m_objMatrixLoc;
|
||||
int m_objTextureLoc;
|
||||
int m_matrixLoc;
|
||||
int m_textureLoc;
|
||||
//int m_objColorLoc;
|
||||
static const QString m_strVertexShaderSourceArray;
|
||||
static const QString m_strFragmentShaderSourceColored;
|
||||
|
@ -36,7 +36,7 @@ TVScreen::TVScreen(bool blnColor, QWidget* parent) :
|
||||
connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
|
||||
m_objTimer.start(40); // capped at 25 FPS
|
||||
|
||||
m_chrLastData = NULL;
|
||||
m_chrLastData = nullptr;
|
||||
m_blnConfigChanged = false;
|
||||
m_blnDataChanged = false;
|
||||
m_blnGLContextInitialized = false;
|
||||
@ -50,7 +50,6 @@ TVScreen::TVScreen(bool blnColor, QWidget* parent) :
|
||||
|
||||
TVScreen::~TVScreen()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void TVScreen::setColor(bool blnColor)
|
||||
@ -62,7 +61,7 @@ QRgb* TVScreen::getRowBuffer(int intRow)
|
||||
{
|
||||
if (!m_blnGLContextInitialized)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_objGLShaderArray.GetRowBuffer(intRow);
|
||||
@ -127,7 +126,7 @@ void TVScreen::initializeGL()
|
||||
|
||||
QSurface *objSurface = objGlCurrentContext->surface();
|
||||
|
||||
if (objSurface == NULL)
|
||||
if (objSurface == nullptr)
|
||||
{
|
||||
qCritical() << "TVScreen::initializeGL: no surface attached";
|
||||
return;
|
||||
@ -172,7 +171,7 @@ void TVScreen::paintGL()
|
||||
|
||||
if ((m_intAskedCols != 0) && (m_intAskedRows != 0))
|
||||
{
|
||||
m_objGLShaderArray.InitializeGL(m_intAskedCols, m_intAskedRows);
|
||||
m_objGLShaderArray.initializeGL(m_intAskedCols, m_intAskedRows);
|
||||
m_intAskedCols = 0;
|
||||
m_intAskedRows = 0;
|
||||
}
|
||||
@ -206,7 +205,7 @@ void TVScreen::cleanup()
|
||||
{
|
||||
if (m_blnGLContextInitialized)
|
||||
{
|
||||
m_objGLShaderArray.Cleanup();
|
||||
m_objGLShaderArray.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ TVScreenAnalogBuffer *TVScreenAnalog::getBackBuffer()
|
||||
|
||||
void TVScreenAnalog::resizeTVScreen(int intCols, int intRows)
|
||||
{
|
||||
qDebug("TVScreen::resizeTVScreen: cols: %d, rows: %d", intCols, intRows);
|
||||
qDebug("TVScreenAnalog::resizeTVScreen: cols: %d, rows: %d", intCols, intRows);
|
||||
|
||||
int colsAdj = intCols + 4;
|
||||
QMutexLocker lock(&m_buffersMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user