viewer/various: split off color management into separate base class

Also moves scopes to said base class.
This commit is contained in:
itsmattkc
2020-04-24 03:45:07 +10:00
18 changed files with 203 additions and 131 deletions
+10 -11
View File
@@ -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();