change: change code style to Linux style except indent.
This commit is contained in:
@@ -27,120 +27,124 @@
|
||||
#include "common/qtutils.h"
|
||||
#include "node/node.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
#define super ScopeBase
|
||||
|
||||
HistogramScope::HistogramScope(QWidget* parent) :
|
||||
super(parent)
|
||||
HistogramScope::HistogramScope(QWidget *parent)
|
||||
: super(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void HistogramScope::OnInit()
|
||||
{
|
||||
super::OnInit();
|
||||
super::OnInit();
|
||||
|
||||
ShaderCode secondary_code(FileFunctions::ReadFileAsString(":/shaders/rgbhistogram_secondary.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.vert"));
|
||||
pipeline_secondary_ = renderer()->CreateNativeShader(secondary_code);
|
||||
ShaderCode secondary_code(
|
||||
FileFunctions::ReadFileAsString(
|
||||
":/shaders/rgbhistogram_secondary.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.vert"));
|
||||
pipeline_secondary_ = renderer()->CreateNativeShader(secondary_code);
|
||||
}
|
||||
|
||||
void HistogramScope::OnDestroy()
|
||||
{
|
||||
pipeline_secondary_.clear();
|
||||
texture_row_sums_ = nullptr;
|
||||
pipeline_secondary_.clear();
|
||||
texture_row_sums_ = nullptr;
|
||||
|
||||
super::OnDestroy();
|
||||
super::OnDestroy();
|
||||
}
|
||||
|
||||
ShaderCode HistogramScope::GenerateShaderCode()
|
||||
{
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/default.vert"));
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/default.vert"));
|
||||
}
|
||||
|
||||
void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
float histogram_scale = 0.80f;
|
||||
// This value is eyeballed for usefulness. Until we have a geometry
|
||||
// shader approach, it is impossible to normalize against a peak
|
||||
// sum of image values.
|
||||
float histogram_base = 2.5f;
|
||||
float histogram_power = 1.0f / histogram_base;
|
||||
float histogram_scale = 0.80f;
|
||||
// This value is eyeballed for usefulness. Until we have a geometry
|
||||
// shader approach, it is impossible to normalize against a peak
|
||||
// sum of image values.
|
||||
float histogram_base = 2.5f;
|
||||
float histogram_power = 1.0f / histogram_base;
|
||||
|
||||
ShaderJob shader_job;
|
||||
ShaderJob shader_job;
|
||||
|
||||
shader_job.Insert(QStringLiteral("viewport"), NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
|
||||
shader_job.Insert(QStringLiteral("histogram_scale"), NodeValue(NodeValue::kFloat, histogram_scale));
|
||||
shader_job.Insert(QStringLiteral("histogram_power"), NodeValue(NodeValue::kFloat, histogram_power));
|
||||
shader_job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2,
|
||||
QVector2D(width(), height())));
|
||||
shader_job.Insert(QStringLiteral("histogram_scale"),
|
||||
NodeValue(NodeValue::kFloat, histogram_scale));
|
||||
shader_job.Insert(QStringLiteral("histogram_power"),
|
||||
NodeValue(NodeValue::kFloat, histogram_power));
|
||||
|
||||
if (!texture_row_sums_
|
||||
|| texture_row_sums_->width() != this->width()
|
||||
|| texture_row_sums_->height() != this->height()) {
|
||||
texture_row_sums_ = renderer()->CreateTexture(VideoParams(width(), height(),
|
||||
managed_tex->format(),
|
||||
managed_tex->channel_count()));
|
||||
}
|
||||
if (!texture_row_sums_ || texture_row_sums_->width() != this->width() ||
|
||||
texture_row_sums_->height() != this->height()) {
|
||||
texture_row_sums_ = renderer()->CreateTexture(
|
||||
VideoParams(width(), height(), managed_tex->format(),
|
||||
managed_tex->channel_count()));
|
||||
}
|
||||
|
||||
// Draw managed texture to a sums texture
|
||||
shader_job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
|
||||
renderer()->BlitToTexture(pipeline, shader_job, texture_row_sums_.get());
|
||||
// Draw managed texture to a sums texture
|
||||
shader_job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
renderer()->BlitToTexture(pipeline, shader_job, texture_row_sums_.get());
|
||||
|
||||
// Draw sums into a histogram
|
||||
shader_job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture_row_sums_)));
|
||||
renderer()->Blit(pipeline_secondary_, shader_job, texture_row_sums_->params());
|
||||
// Draw sums into a histogram
|
||||
shader_job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
QVariant::fromValue(texture_row_sums_)));
|
||||
renderer()->Blit(pipeline_secondary_, shader_job,
|
||||
texture_row_sums_->params());
|
||||
|
||||
// Draw line overlays
|
||||
QPainter p(paint_device());
|
||||
QFont font = p.font();
|
||||
font.setPixelSize(10);
|
||||
QFontMetrics font_metrics = QFontMetrics(font);
|
||||
QString label;
|
||||
std::vector<float> histogram_increments = {
|
||||
0.00,
|
||||
0.25,
|
||||
0.50,
|
||||
1.0
|
||||
};
|
||||
// Draw line overlays
|
||||
QPainter p(paint_device());
|
||||
QFont font = p.font();
|
||||
font.setPixelSize(10);
|
||||
QFontMetrics font_metrics = QFontMetrics(font);
|
||||
QString label;
|
||||
std::vector<float> histogram_increments = { 0.00, 0.25, 0.50, 1.0 };
|
||||
|
||||
int histogram_steps = histogram_increments.size();
|
||||
QVector<QLine> histogram_lines(histogram_steps + 1);
|
||||
int font_x_offset = 0;
|
||||
int font_y_offset = font_metrics.capHeight() / 2.0f;
|
||||
int histogram_steps = histogram_increments.size();
|
||||
QVector<QLine> histogram_lines(histogram_steps + 1);
|
||||
int font_x_offset = 0;
|
||||
int font_y_offset = font_metrics.capHeight() / 2.0f;
|
||||
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
|
||||
p.setPen(QColor(0.0, 0.6 * 255.0, 0.0));
|
||||
p.setFont(font);
|
||||
p.setPen(QColor(0.0, 0.6 * 255.0, 0.0));
|
||||
p.setFont(font);
|
||||
|
||||
float histogram_dim_x = ceil((width() - 1.0) * histogram_scale);
|
||||
float histogram_dim_y = ceil((height() - 1.0) * histogram_scale);
|
||||
float histogram_start_dim_x =
|
||||
((width() - 1.0) - histogram_dim_x) / 2.0f;
|
||||
float histogram_start_dim_y =
|
||||
((height() - 1.0) - histogram_dim_y) / 2.0f;
|
||||
float histogram_end_dim_x = (width() - 1.0) - histogram_start_dim_x;
|
||||
float histogram_dim_x = ceil((width() - 1.0) * histogram_scale);
|
||||
float histogram_dim_y = ceil((height() - 1.0) * histogram_scale);
|
||||
float histogram_start_dim_x = ((width() - 1.0) - histogram_dim_x) / 2.0f;
|
||||
float histogram_start_dim_y = ((height() - 1.0) - histogram_dim_y) / 2.0f;
|
||||
float histogram_end_dim_x = (width() - 1.0) - histogram_start_dim_x;
|
||||
|
||||
// for (int i=0; i <= histogram_steps; i++) {
|
||||
for(std::vector<float>::iterator it = histogram_increments.begin();
|
||||
it != histogram_increments.end(); it++) {
|
||||
histogram_lines[it - histogram_increments.begin()].setLine(
|
||||
histogram_start_dim_x,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y,
|
||||
histogram_end_dim_x,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y);
|
||||
label = QString::number(
|
||||
*it * 100, 'f', 1) + "%";
|
||||
font_x_offset = QtUtils::QFontMetricsWidth(font_metrics, label) + 4;
|
||||
// for (int i=0; i <= histogram_steps; i++) {
|
||||
for (std::vector<float>::iterator it = histogram_increments.begin();
|
||||
it != histogram_increments.end(); it++) {
|
||||
histogram_lines[it - histogram_increments.begin()].setLine(
|
||||
histogram_start_dim_x,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y,
|
||||
histogram_end_dim_x,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y);
|
||||
label = QString::number(*it * 100, 'f', 1) + "%";
|
||||
font_x_offset = QtUtils::QFontMetricsWidth(font_metrics, label) + 4;
|
||||
|
||||
p.drawText(
|
||||
histogram_start_dim_x - font_x_offset,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y + font_y_offset, label);
|
||||
}
|
||||
p.drawLines(histogram_lines);
|
||||
p.drawText(histogram_start_dim_x - font_x_offset,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
histogram_start_dim_y + font_y_offset,
|
||||
label);
|
||||
}
|
||||
p.drawLines(histogram_lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,31 +23,30 @@
|
||||
|
||||
#include "widget/scope/scopebase/scopebase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class HistogramScope : public ScopeBase
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HistogramScope(QWidget* parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(HistogramScope)
|
||||
class HistogramScope : public ScopeBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
HistogramScope(QWidget *parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(HistogramScope)
|
||||
|
||||
protected slots:
|
||||
virtual void OnInit() override;
|
||||
virtual void OnInit() override;
|
||||
|
||||
virtual void OnDestroy() override;
|
||||
virtual void OnDestroy() override;
|
||||
|
||||
protected:
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
QVariant CreateSecondaryShader();
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
QVariant CreateSecondaryShader();
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
|
||||
private:
|
||||
QVariant pipeline_secondary_;
|
||||
TexturePtr texture_row_sums_;
|
||||
|
||||
QVariant pipeline_secondary_;
|
||||
TexturePtr texture_row_sums_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -22,76 +22,79 @@
|
||||
|
||||
#include "config/config.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
#define super ManagedDisplayWidget
|
||||
|
||||
ScopeBase::ScopeBase(QWidget* parent) :
|
||||
super(parent),
|
||||
texture_(nullptr),
|
||||
managed_tex_up_to_date_(false)
|
||||
ScopeBase::ScopeBase(QWidget *parent)
|
||||
: super(parent)
|
||||
, texture_(nullptr)
|
||||
, managed_tex_up_to_date_(false)
|
||||
{
|
||||
EnableDefaultContextMenu();
|
||||
EnableDefaultContextMenu();
|
||||
}
|
||||
|
||||
void ScopeBase::SetBuffer(TexturePtr frame)
|
||||
{
|
||||
texture_ = frame;
|
||||
managed_tex_up_to_date_ = false;
|
||||
update();
|
||||
texture_ = frame;
|
||||
managed_tex_up_to_date_ = false;
|
||||
update();
|
||||
}
|
||||
|
||||
void ScopeBase::showEvent(QShowEvent* e)
|
||||
void ScopeBase::showEvent(QShowEvent *e)
|
||||
{
|
||||
super::showEvent(e);
|
||||
super::showEvent(e);
|
||||
}
|
||||
|
||||
void ScopeBase::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
ShaderJob job;
|
||||
ShaderJob job;
|
||||
|
||||
job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
}
|
||||
|
||||
void ScopeBase::OnInit()
|
||||
{
|
||||
super::OnInit();
|
||||
super::OnInit();
|
||||
|
||||
pipeline_ = renderer()->CreateNativeShader(GenerateShaderCode());
|
||||
pipeline_ = renderer()->CreateNativeShader(GenerateShaderCode());
|
||||
}
|
||||
|
||||
void ScopeBase::OnPaint()
|
||||
{
|
||||
// Clear display surface
|
||||
renderer()->ClearDestination();
|
||||
// Clear display surface
|
||||
renderer()->ClearDestination();
|
||||
|
||||
if (texture_) {
|
||||
// Convert reference frame to display space
|
||||
if (!managed_tex_ || !managed_tex_up_to_date_
|
||||
|| managed_tex_->params() != texture_->params()) {
|
||||
managed_tex_ = renderer()->CreateTexture(texture_->params());
|
||||
if (texture_) {
|
||||
// Convert reference frame to display space
|
||||
if (!managed_tex_ || !managed_tex_up_to_date_ ||
|
||||
managed_tex_->params() != texture_->params()) {
|
||||
managed_tex_ = renderer()->CreateTexture(texture_->params());
|
||||
|
||||
ColorTransformJob job;
|
||||
job.SetColorProcessor(color_service());
|
||||
job.SetInputTexture(texture_);
|
||||
job.SetInputAlphaAssociation(kAlphaNone);
|
||||
ColorTransformJob job;
|
||||
job.SetColorProcessor(color_service());
|
||||
job.SetInputTexture(texture_);
|
||||
job.SetInputAlphaAssociation(kAlphaNone);
|
||||
|
||||
renderer()->BlitColorManaged(job, managed_tex_.get());
|
||||
}
|
||||
renderer()->BlitColorManaged(job, managed_tex_.get());
|
||||
}
|
||||
|
||||
DrawScope(managed_tex_, pipeline_);
|
||||
}
|
||||
DrawScope(managed_tex_, pipeline_);
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeBase::OnDestroy()
|
||||
{
|
||||
managed_tex_ = nullptr;
|
||||
texture_ = nullptr;
|
||||
pipeline_.clear();
|
||||
managed_tex_ = nullptr;
|
||||
texture_ = nullptr;
|
||||
pipeline_.clear();
|
||||
|
||||
super::OnDestroy();
|
||||
super::OnDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,46 +25,45 @@
|
||||
#include "render/colorprocessor.h"
|
||||
#include "widget/manageddisplay/manageddisplay.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ScopeBase : public ManagedDisplayWidget
|
||||
namespace olive
|
||||
{
|
||||
public:
|
||||
ScopeBase(QWidget* parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(ScopeBase)
|
||||
class ScopeBase : public ManagedDisplayWidget {
|
||||
public:
|
||||
ScopeBase(QWidget *parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(ScopeBase)
|
||||
|
||||
public slots:
|
||||
void SetBuffer(TexturePtr frame);
|
||||
void SetBuffer(TexturePtr frame);
|
||||
|
||||
protected slots:
|
||||
virtual void OnInit() override;
|
||||
virtual void OnInit() override;
|
||||
|
||||
virtual void OnPaint() override;
|
||||
virtual void OnPaint() override;
|
||||
|
||||
virtual void OnDestroy() override;
|
||||
virtual void OnDestroy() override;
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* e) override;
|
||||
virtual void showEvent(QShowEvent *e) override;
|
||||
|
||||
virtual ShaderCode GenerateShaderCode() = 0;
|
||||
virtual ShaderCode GenerateShaderCode() = 0;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Draw function
|
||||
*
|
||||
* Override this if your sub-class scope needs extra drawing.
|
||||
*/
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline);
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline);
|
||||
|
||||
private:
|
||||
QVariant pipeline_;
|
||||
QVariant pipeline_;
|
||||
|
||||
TexturePtr texture_;
|
||||
TexturePtr texture_;
|
||||
|
||||
TexturePtr managed_tex_;
|
||||
|
||||
bool managed_tex_up_to_date_;
|
||||
TexturePtr managed_tex_;
|
||||
|
||||
bool managed_tex_up_to_date_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -31,90 +31,92 @@
|
||||
#include "config/config.h"
|
||||
#include "node/node.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
#define super ScopeBase
|
||||
|
||||
WaveformScope::WaveformScope(QWidget* parent) :
|
||||
super(parent)
|
||||
WaveformScope::WaveformScope(QWidget *parent)
|
||||
: super(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderCode WaveformScope::GenerateShaderCode()
|
||||
{
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.vert"));
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.vert"));
|
||||
}
|
||||
|
||||
void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
float waveform_scale = 0.80f;
|
||||
float waveform_scale = 0.80f;
|
||||
|
||||
// Draw waveform through shader
|
||||
ShaderJob job;
|
||||
// Draw waveform through shader
|
||||
ShaderJob job;
|
||||
|
||||
// Set viewport size
|
||||
job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
|
||||
// Set viewport size
|
||||
job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
|
||||
|
||||
// Set luma coefficients
|
||||
double luma_coeffs[3] = {0.0f, 0.0f, 0.0f};
|
||||
color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
// Set luma coefficients
|
||||
double luma_coeffs[3] = { 0.0f, 0.0f, 0.0f };
|
||||
color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(
|
||||
QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3,
|
||||
QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
|
||||
// Scale of the waveform relative to the viewport surface.
|
||||
job.Insert(QStringLiteral("waveform_scale"),
|
||||
NodeValue(NodeValue::kFloat, waveform_scale));
|
||||
|
||||
// Scale of the waveform relative to the viewport surface.
|
||||
job.Insert(QStringLiteral("waveform_scale"),
|
||||
NodeValue(NodeValue::kFloat, waveform_scale));
|
||||
// Insert source texture
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
|
||||
// Insert source texture
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
float waveform_dim_x = ceil((width() - 1.0) * waveform_scale);
|
||||
float waveform_dim_y = ceil((height() - 1.0) * waveform_scale);
|
||||
float waveform_start_dim_x = ((width() - 1.0) - waveform_dim_x) / 2.0f;
|
||||
float waveform_start_dim_y = ((height() - 1.0) - waveform_dim_y) / 2.0f;
|
||||
float waveform_end_dim_x = (width() - 1.0) - waveform_start_dim_x;
|
||||
|
||||
float waveform_dim_x = ceil((width() - 1.0) * waveform_scale);
|
||||
float waveform_dim_y = ceil((height() - 1.0) * waveform_scale);
|
||||
float waveform_start_dim_x =
|
||||
((width() - 1.0) - waveform_dim_x) / 2.0f;
|
||||
float waveform_start_dim_y =
|
||||
((height() - 1.0) - waveform_dim_y) / 2.0f;
|
||||
float waveform_end_dim_x = (width() - 1.0) - waveform_start_dim_x;
|
||||
// Draw line overlays
|
||||
QPainter p(paint_device());
|
||||
QFont font;
|
||||
font.setPixelSize(10);
|
||||
QFontMetrics font_metrics = QFontMetrics(font);
|
||||
QString label;
|
||||
float ire_increment = 0.1f;
|
||||
int ire_steps = qRound(1.0 / ire_increment);
|
||||
QVector<QLine> ire_lines(ire_steps + 1);
|
||||
int font_x_offset = 0;
|
||||
int font_y_offset = font_metrics.capHeight() / 2.0f;
|
||||
|
||||
// Draw line overlays
|
||||
QPainter p(paint_device());
|
||||
QFont font;
|
||||
font.setPixelSize(10);
|
||||
QFontMetrics font_metrics = QFontMetrics(font);
|
||||
QString label;
|
||||
float ire_increment = 0.1f;
|
||||
int ire_steps = qRound(1.0 / ire_increment);
|
||||
QVector<QLine> ire_lines(ire_steps + 1);
|
||||
int font_x_offset = 0;
|
||||
int font_y_offset = font_metrics.capHeight() / 2.0f;
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
p.setPen(QColor(0.0, 0.6 * 255.0, 0.0));
|
||||
p.setFont(font);
|
||||
|
||||
p.setPen(QColor(0.0, 0.6 * 255.0, 0.0));
|
||||
p.setFont(font);
|
||||
for (int i = 0; i <= ire_steps; i++) {
|
||||
ire_lines[i].setLine(
|
||||
waveform_start_dim_x,
|
||||
(waveform_dim_y * (i * ire_increment)) + waveform_start_dim_y,
|
||||
waveform_end_dim_x,
|
||||
(waveform_dim_y * (i * ire_increment)) + waveform_start_dim_y);
|
||||
label = QString::number(1.0 - (i * ire_increment), 'f', 1);
|
||||
font_x_offset = QtUtils::QFontMetricsWidth(font_metrics, label) + 4;
|
||||
|
||||
for (int i=0; i <= ire_steps; i++) {
|
||||
ire_lines[i].setLine(
|
||||
waveform_start_dim_x,
|
||||
(waveform_dim_y * (i * ire_increment)) + waveform_start_dim_y,
|
||||
waveform_end_dim_x,
|
||||
(waveform_dim_y * (i * ire_increment)) + waveform_start_dim_y);
|
||||
label = QString::number(1.0 - (i * ire_increment), 'f', 1);
|
||||
font_x_offset = QtUtils::QFontMetricsWidth(font_metrics, label) + 4;
|
||||
p.drawText(waveform_start_dim_x - font_x_offset,
|
||||
(waveform_dim_y * (i * ire_increment)) +
|
||||
waveform_start_dim_y + font_y_offset,
|
||||
label);
|
||||
}
|
||||
|
||||
p.drawText(
|
||||
waveform_start_dim_x - font_x_offset,
|
||||
(waveform_dim_y * (i * ire_increment)) + waveform_start_dim_y + font_y_offset,
|
||||
label);
|
||||
}
|
||||
|
||||
p.drawLines(ire_lines);
|
||||
p.drawLines(ire_lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,21 +23,20 @@
|
||||
|
||||
#include "widget/scope/scopebase/scopebase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class WaveformScope : public ScopeBase
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WaveformScope(QWidget* parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(WaveformScope)
|
||||
class WaveformScope : public ScopeBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
WaveformScope(QWidget *parent = nullptr);
|
||||
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(WaveformScope)
|
||||
|
||||
protected:
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user