viewer/various: split off color management into separate base class
Also moves scopes to said base class.
This commit is contained in:
@@ -29,10 +29,11 @@
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
HistogramScope::HistogramScope(QWidget* parent) :
|
||||
QOpenGLWidget(parent),
|
||||
buffer_(nullptr),
|
||||
processor_(nullptr)
|
||||
ManagedDisplayWidget(parent),
|
||||
buffer_(nullptr)
|
||||
{
|
||||
EnableDefaultContextMenu();
|
||||
|
||||
connect(&worker_, &HistogramScopeWorker::Finished, this, &HistogramScope::FinishedProcessing, Qt::QueuedConnection);
|
||||
worker_.start(QThread::IdlePriority);
|
||||
}
|
||||
@@ -51,13 +52,6 @@ void HistogramScope::SetBuffer(Frame* frame)
|
||||
StartUpdate();
|
||||
}
|
||||
|
||||
void HistogramScope::SetColorProcessor(ColorProcessorPtr processor)
|
||||
{
|
||||
processor_ = processor;
|
||||
|
||||
StartUpdate();
|
||||
}
|
||||
|
||||
void HistogramScope::FinishedProcessing(QVector<double> red, QVector<double> green, QVector<double> blue)
|
||||
{
|
||||
red_val_ = red;
|
||||
@@ -99,10 +93,15 @@ void HistogramScope::resizeEvent(QResizeEvent *e)
|
||||
StartUpdate();
|
||||
}
|
||||
|
||||
void HistogramScope::ColorProcessorChangedEvent()
|
||||
{
|
||||
StartUpdate();
|
||||
}
|
||||
|
||||
void HistogramScope::StartUpdate()
|
||||
{
|
||||
if (buffer_) {
|
||||
worker_.QueueNext(*buffer_, processor_, width());
|
||||
worker_.QueueNext(*buffer_, color_service(), width());
|
||||
} else {
|
||||
// Update with nothing
|
||||
red_val_.clear();
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#define HISTOGRAMSCOPE_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "codec/frame.h"
|
||||
#include "render/colorprocessor.h"
|
||||
#include "widget/manageddisplay/manageddisplay.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class HistogramScope : public QOpenGLWidget
|
||||
class HistogramScope : public ManagedDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -71,21 +71,18 @@ public:
|
||||
public slots:
|
||||
void SetBuffer(Frame* frame);
|
||||
|
||||
void SetColorProcessor(ColorProcessorPtr processor);
|
||||
|
||||
protected:
|
||||
// virtual void paintEvent(QPaintEvent* e) override;
|
||||
virtual void paintGL() override;
|
||||
|
||||
virtual void resizeEvent(QResizeEvent* e) override;
|
||||
|
||||
virtual void ColorProcessorChangedEvent() override;
|
||||
|
||||
private:
|
||||
void StartUpdate();
|
||||
|
||||
Frame* buffer_;
|
||||
|
||||
ColorProcessorPtr processor_;
|
||||
|
||||
QVector<double> red_val_;
|
||||
|
||||
QVector<double> green_val_;
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
WaveformScope::WaveformScope(QWidget* parent) :
|
||||
QOpenGLWidget(parent),
|
||||
ManagedDisplayWidget(parent),
|
||||
texture_(nullptr)
|
||||
{
|
||||
|
||||
EnableDefaultContextMenu();
|
||||
}
|
||||
|
||||
void WaveformScope::SetTexture(OpenGLTexture *texture)
|
||||
@@ -42,6 +42,8 @@ void WaveformScope::SetTexture(OpenGLTexture *texture)
|
||||
|
||||
void WaveformScope::initializeGL()
|
||||
{
|
||||
ManagedDisplayWidget::initializeGL();
|
||||
|
||||
pipeline_ = OpenGLShader::Create();
|
||||
pipeline_->create();
|
||||
pipeline_->addShaderFromSourceCode(QOpenGLShader::Vertex, OpenGLShader::CodeDefaultVertex());
|
||||
|
||||
@@ -21,16 +21,15 @@
|
||||
#ifndef WAVEFORMSCOPE_H
|
||||
#define WAVEFORMSCOPE_H
|
||||
|
||||
#include <QOpenGLWidget>
|
||||
|
||||
#include "codec/frame.h"
|
||||
#include "render/backend/opengl/openglcolorprocessor.h"
|
||||
#include "render/backend/opengl/openglshader.h"
|
||||
#include "render/backend/opengl/opengltexture.h"
|
||||
#include "widget/manageddisplay/manageddisplay.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
class WaveformScope : public QOpenGLWidget
|
||||
class WaveformScope : public ManagedDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user