From 6636fc75fa8806e9a983bdda09c4ca72e5c41ba3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 25 Feb 2017 06:56:09 +0100 Subject: [PATCH] ATV demod: ATV screen: reviewed screen shader intialization sequences --- plugins/channelrx/demodatv/atvscreen.cpp | 28 ++++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/plugins/channelrx/demodatv/atvscreen.cpp b/plugins/channelrx/demodatv/atvscreen.cpp index 91b29a72d..86da014bf 100644 --- a/plugins/channelrx/demodatv/atvscreen.cpp +++ b/plugins/channelrx/demodatv/atvscreen.cpp @@ -39,9 +39,9 @@ ATVScreen::ATVScreen(QWidget* parent) : m_blnDataChanged = false; m_blnGLContextInitialized = false; - m_intAskedCols = 0; - m_intAskedRows = 0; - + //Par défaut + m_intAskedCols = ATV_COLS; + m_intAskedRows = ATV_ROWS; } ATVScreen::~ATVScreen() @@ -129,10 +129,6 @@ void ATVScreen::initializeGL() connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &ATVScreen::cleanup); // TODO: when migrating to QOpenGLWidget - //Par défaut - m_intAskedCols = ATV_COLS; - m_intAskedRows = ATV_ROWS; - m_blnGLContextInitialized = true; m_objMutex.unlock(); @@ -147,22 +143,20 @@ void ATVScreen::resizeGL(int intWidth, int intHeight) void ATVScreen::paintGL() { - m_objMutex.lock(); + if (!m_objMutex.tryLock(2)) + return; m_blnDataChanged = false; - 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_intAskedCols = 0; - m_intAskedRows = 0; - } - - m_objGLShaderArray.RenderPixels(m_chrLastData); + m_objGLShaderArray.InitializeGL(m_intAskedCols, m_intAskedRows); + m_intAskedCols = 0; + m_intAskedRows = 0; } + m_objGLShaderArray.RenderPixels(m_chrLastData); + m_objMutex.unlock(); }