scopes: only update if visible

Updating scopes can require heavy processing so we limit updates to only
when the scope is visible
This commit is contained in:
itsmattkc
2020-04-28 23:55:40 +10:00
parent ad419754a9
commit 61dd75a2ed
4 changed files with 22 additions and 2 deletions
+10 -1
View File
@@ -49,7 +49,9 @@ void HistogramScope::SetBuffer(Frame* frame)
{
buffer_ = frame;
StartUpdate();
if (isVisible()) {
StartUpdate();
}
}
void HistogramScope::FinishedProcessing(QVector<double> red, QVector<double> green, QVector<double> blue)
@@ -111,6 +113,13 @@ void HistogramScope::StartUpdate()
}
}
void HistogramScope::showEvent(QShowEvent* e)
{
ManagedDisplayWidget::showEvent(e);
StartUpdate();
}
HistogramScopeWorker::HistogramScopeWorker() :
cancelled_(false)
{
+2
View File
@@ -78,6 +78,8 @@ protected:
virtual void ColorProcessorChangedEvent() override;
virtual void showEvent(QShowEvent* e) override;
private:
void StartUpdate();
+8 -1
View File
@@ -49,6 +49,13 @@ void WaveformScope::SetBuffer(Frame *frame)
UploadTextureFromBuffer();
}
void WaveformScope::showEvent(QShowEvent* e)
{
ManagedDisplayWidget::showEvent(e);
UploadTextureFromBuffer();
}
void WaveformScope::initializeGL()
{
ManagedDisplayWidget::initializeGL();
@@ -93,7 +100,7 @@ void WaveformScope::paintGL()
void WaveformScope::UploadTextureFromBuffer()
{
if (!buffer_) {
if (!buffer_ || !isVisible()) {
return;
}
+2
View File
@@ -45,6 +45,8 @@ protected:
virtual void paintGL() override;
virtual void showEvent(QShowEvent* e) override;
private:
void UploadTextureFromBuffer();