1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

ATV Demod: cosmetic reformatting

This commit is contained in:
f4exb 2017-02-25 05:10:54 +01:00
parent 864df4d232
commit a5df0a1ee4
2 changed files with 69 additions and 70 deletions

View File

@ -28,30 +28,30 @@
#include <QDebug> #include <QDebug>
ATVScreen::ATVScreen(QWidget* parent) : ATVScreen::ATVScreen(QWidget* parent) :
QGLWidget(parent), QGLWidget(parent), m_objMutex(QMutex::NonRecursive)
m_objMutex(QMutex::NonRecursive)
{ {
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
//connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); //connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
//m_objTimer.start(50); //m_objTimer.start(50);
m_chrLastData=NULL; m_chrLastData = NULL;
m_blnDataChanged=false; m_blnConfigChanged = false;
m_blnGLContextInitialized=false; m_blnDataChanged = false;
m_blnGLContextInitialized = false;
m_intAskedCols=0; m_intAskedCols = 0;
m_intAskedRows=0; m_intAskedRows = 0;
} }
ATVScreen::~ATVScreen() ATVScreen::~ATVScreen()
{ {
cleanup(); cleanup();
} }
QRgb* ATVScreen::getRowBuffer(int intRow) QRgb* ATVScreen::getRowBuffer(int intRow)
{ {
if(m_blnGLContextInitialized==false) if (m_blnGLContextInitialized == false)
{ {
return NULL; return NULL;
} }
@ -61,7 +61,7 @@ QRgb* ATVScreen::getRowBuffer(int intRow)
void ATVScreen::renderImage(unsigned char * objData) void ATVScreen::renderImage(unsigned char * objData)
{ {
m_chrLastData=objData; m_chrLastData = objData;
update(); update();
} }
@ -72,63 +72,67 @@ void ATVScreen::resetImage()
void ATVScreen::resizeATVScreen(int intCols, int intRows) void ATVScreen::resizeATVScreen(int intCols, int intRows)
{ {
m_intAskedCols=intCols; m_intAskedCols = intCols;
m_intAskedRows=intRows; m_intAskedRows = intRows;
} }
void ATVScreen::initializeGL() void ATVScreen::initializeGL()
{ {
m_objMutex.lock(); m_objMutex.lock();
QOpenGLContext *objGlCurrentContext = QOpenGLContext::currentContext(); QOpenGLContext *objGlCurrentContext = QOpenGLContext::currentContext();
if (objGlCurrentContext) if (objGlCurrentContext)
{ {
if (QOpenGLContext::currentContext()->isValid()) if (QOpenGLContext::currentContext()->isValid())
{ {
qDebug() << "ATVScreen::initializeGL: context:" qDebug() << "ATVScreen::initializeGL: context:"
<< " major: " << (QOpenGLContext::currentContext()->format()).majorVersion() << " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
<< " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion() << " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
<< " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no"); << " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
} }
else else
{ {
qDebug() << "ATVScreen::initializeGL: current context is invalid"; qDebug() << "ATVScreen::initializeGL: current context is invalid";
} }
} }
else else
{ {
qCritical() << "ATVScreen::initializeGL: no current context"; qCritical() << "ATVScreen::initializeGL: no current context";
return; return;
} }
QSurface *objSurface = objGlCurrentContext->surface(); QSurface *objSurface = objGlCurrentContext->surface();
if (objSurface == NULL) if (objSurface == NULL)
{ {
qCritical() << "ATVScreen::initializeGL: no surface attached"; qCritical() << "ATVScreen::initializeGL: no surface attached";
return; return;
} }
else else
{ {
if (objSurface->surfaceType() != QSurface::OpenGLSurface) if (objSurface->surfaceType() != QSurface::OpenGLSurface)
{ {
qCritical() << "ATVScreen::initializeGL: surface is not an OpenGLSurface: " << objSurface->surfaceType() << " cannot use an OpenGL context"; qCritical() << "ATVScreen::initializeGL: surface is not an OpenGLSurface: "
return; << objSurface->surfaceType()
} << " cannot use an OpenGL context";
else return;
{ }
qDebug() << "ATVScreen::initializeGL: OpenGL surface:" << " class: " << (objSurface->surfaceClass() == QSurface::Window ? "Window" : "Offscreen"); else
} {
} qDebug() << "ATVScreen::initializeGL: OpenGL surface:"
<< " class: " << (objSurface->surfaceClass() == QSurface::Window ? "Window" : "Offscreen");
}
}
connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &ATVScreen::cleanup); // TODO: when migrating to QOpenGLWidget connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this,
&ATVScreen::cleanup); // TODO: when migrating to QOpenGLWidget
//Par défaut //Par défaut
m_intAskedCols = ATV_COLS; m_intAskedCols = ATV_COLS;
m_intAskedRows = ATV_ROWS; m_intAskedRows = ATV_ROWS;
m_blnGLContextInitialized=true; m_blnGLContextInitialized = true;
m_objMutex.unlock(); m_objMutex.unlock();
} }
@ -144,13 +148,13 @@ void ATVScreen::paintGL()
{ {
m_objMutex.lock(); m_objMutex.lock();
if(m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
if((m_intAskedCols!=0) && (m_intAskedRows!=0)) 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_intAskedCols = 0;
m_intAskedRows=0; m_intAskedRows = 0;
} }
m_objGLShaderArray.RenderPixels(m_chrLastData); m_objGLShaderArray.RenderPixels(m_chrLastData);
@ -163,43 +167,41 @@ void ATVScreen::mousePressEvent(QMouseEvent* event)
{ {
} }
void ATVScreen::tick() void ATVScreen::tick()
{ {
} }
void ATVScreen::connectTimer(const QTimer& objTimer) void ATVScreen::connectTimer(const QTimer& objTimer)
{ {
/* /*
qDebug() << "ATVScreen::connectTimer"; qDebug() << "ATVScreen::connectTimer";
disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick()));
connect(&objTimer, SIGNAL(timeout()), this, SLOT(tick())); connect(&objTimer, SIGNAL(timeout()), this, SLOT(tick()));
m_objTimer.stop(); m_objTimer.stop();
*/ */
} }
void ATVScreen::cleanup() void ATVScreen::cleanup()
{ {
if(m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
m_objGLShaderArray.Cleanup(); m_objGLShaderArray.Cleanup();
} }
} }
bool ATVScreen::selectRow(int intLine) bool ATVScreen::selectRow(int intLine)
{ {
if(m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
return m_objGLShaderArray.SelectRow(intLine); return m_objGLShaderArray.SelectRow(intLine);
} }
} }
bool ATVScreen::setDataColor(int intCol,int intRed, int intGreen, int intBlue) bool ATVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue)
{ {
if(m_blnGLContextInitialized) if (m_blnGLContextInitialized)
{ {
return m_objGLShaderArray.SetDataColor(intCol, qRgb(intRed, intGreen, intBlue)); return m_objGLShaderArray.SetDataColor(intCol,
qRgb(intRed, intGreen, intBlue));
} }
} }

View File

@ -28,15 +28,12 @@
#include <QFont> #include <QFont>
#include <QMatrix4x4> #include <QMatrix4x4>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "dsp/scopevis.h"
#include "gui/scaleengine.h"
#include "glshaderarray.h" #include "glshaderarray.h"
#include "gui/glshadertextured.h" #include "gui/glshadertextured.h"
#include "util/export.h" #include "util/export.h"
#include "util/bitfieldindex.h" #include "util/bitfieldindex.h"
class ScopeVis;
class QPainter; class QPainter;