style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -39,33 +39,33 @@ HistogramScope::HistogramScope(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void HistogramScope::OnInit()
|
||||
void HistogramScope::on_init()
|
||||
{
|
||||
super::OnInit();
|
||||
super::on_init();
|
||||
|
||||
ShaderCode secondary_code(
|
||||
FileFunctions::ReadFileAsString(
|
||||
FileFunctions::read_file_as_string(
|
||||
":/shaders/rgbhistogram_secondary.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.vert"));
|
||||
pipeline_secondary_ = renderer()->CreateNativeShader(secondary_code);
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbhistogram.vert"));
|
||||
pipeline_secondary_ = renderer()->create_native_shader(secondary_code);
|
||||
}
|
||||
|
||||
void HistogramScope::OnDestroy()
|
||||
void HistogramScope::on_destroy()
|
||||
{
|
||||
pipeline_secondary_.clear();
|
||||
texture_row_sums_ = nullptr;
|
||||
|
||||
super::OnDestroy();
|
||||
super::on_destroy();
|
||||
}
|
||||
|
||||
ShaderCode HistogramScope::GenerateShaderCode()
|
||||
ShaderCode HistogramScope::generate_shader_code()
|
||||
{
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbhistogram.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/default.vert"));
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbhistogram.frag"),
|
||||
FileFunctions::read_file_as_string(":/shaders/default.vert"));
|
||||
}
|
||||
|
||||
void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
void HistogramScope::draw_scope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
float histogram_scale = 0.80f;
|
||||
// This value is eyeballed for usefulness. Until we have a geometry
|
||||
@@ -76,32 +76,32 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
|
||||
ShaderJob shader_job;
|
||||
|
||||
shader_job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2,
|
||||
shader_job.insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::k_vec2,
|
||||
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("histogram_scale"),
|
||||
NodeValue(NodeValue::k_float, histogram_scale));
|
||||
shader_job.insert(QStringLiteral("histogram_power"),
|
||||
NodeValue(NodeValue::k_float, histogram_power));
|
||||
|
||||
if (!texture_row_sums_ || texture_row_sums_->width() != this->width() ||
|
||||
texture_row_sums_->height() != this->height()) {
|
||||
texture_row_sums_ = renderer()->CreateTexture(
|
||||
texture_row_sums_ = renderer()->create_texture(
|
||||
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,
|
||||
shader_job.insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::k_texture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
renderer()->BlitToTexture(pipeline, shader_job, texture_row_sums_.get());
|
||||
renderer()->blit_to_texture(pipeline, shader_job, texture_row_sums_.get());
|
||||
|
||||
// Draw sums into a histogram
|
||||
shader_job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
shader_job.insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::k_texture,
|
||||
QVariant::fromValue(texture_row_sums_)));
|
||||
renderer()->Blit(pipeline_secondary_, shader_job,
|
||||
renderer()->blit(pipeline_secondary_, shader_job,
|
||||
texture_row_sums_->params());
|
||||
|
||||
// Draw line overlays
|
||||
@@ -139,7 +139,7 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
(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;
|
||||
font_x_offset = QtUtils::q_font_metrics_width(font_metrics, label) + 4;
|
||||
|
||||
p.drawText(histogram_start_dim_x - font_x_offset,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
@@ -149,7 +149,7 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
p.drawLines(histogram_lines);
|
||||
}
|
||||
|
||||
void HistogramScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
void HistogramScope::draw_scope_software(QPainter &p, const QImage &image)
|
||||
{
|
||||
const float histogram_scale = 0.80f;
|
||||
const float histogram_base = 2.5f;
|
||||
@@ -241,7 +241,7 @@ void HistogramScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
(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;
|
||||
font_x_offset = QtUtils::q_font_metrics_width(font_metrics, label) + 4;
|
||||
|
||||
p.drawText(histogram_start_dim_x - font_x_offset,
|
||||
(histogram_dim_y * pow(1.0 - *it, histogram_base)) +
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef HISTOGRAMSCOPE_H
|
||||
#define HISTOGRAMSCOPE_H
|
||||
#ifndef OAK_HISTOGRAMSCOPE_H
|
||||
#define OAK_HISTOGRAMSCOPE_H
|
||||
|
||||
#include "widget/scope/scopebase/scopebase.h"
|
||||
|
||||
@@ -35,17 +35,17 @@ public:
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(HistogramScope)
|
||||
|
||||
protected slots:
|
||||
virtual void OnInit() override;
|
||||
virtual void on_init() override;
|
||||
|
||||
virtual void OnDestroy() override;
|
||||
virtual void on_destroy() override;
|
||||
|
||||
protected:
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
QVariant CreateSecondaryShader();
|
||||
virtual ShaderCode generate_shader_code() override;
|
||||
QVariant create_secondary_shader();
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
virtual void draw_scope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
|
||||
virtual void DrawScopeSoftware(QPainter &p, const QImage &image) override;
|
||||
virtual void draw_scope_software(QPainter &p, const QImage &image) override;
|
||||
|
||||
private:
|
||||
QVariant pipeline_secondary_;
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // HISTOGRAMSCOPE_H
|
||||
#endif // OAK_HISTOGRAMSCOPE_H
|
||||
|
||||
@@ -35,10 +35,10 @@ ScopeBase::ScopeBase(QWidget *parent)
|
||||
, managed_tex_up_to_date_(false)
|
||||
, software_image_up_to_date_(false)
|
||||
{
|
||||
EnableDefaultContextMenu();
|
||||
enable_default_context_menu();
|
||||
}
|
||||
|
||||
void ScopeBase::SetBuffer(TexturePtr frame)
|
||||
void ScopeBase::set_buffer(TexturePtr frame)
|
||||
{
|
||||
texture_ = frame;
|
||||
managed_tex_up_to_date_ = false;
|
||||
@@ -51,20 +51,20 @@ void ScopeBase::showEvent(QShowEvent *e)
|
||||
super::showEvent(e);
|
||||
}
|
||||
|
||||
void ScopeBase::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
void ScopeBase::draw_scope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
ShaderJob job;
|
||||
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
job.insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::k_texture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
renderer()->blit(pipeline, job, get_viewport_params());
|
||||
}
|
||||
|
||||
void ScopeBase::UpdateSoftwareImage()
|
||||
void ScopeBase::update_software_image()
|
||||
{
|
||||
if (!texture_ || texture_->IsDummy() || !renderer()) {
|
||||
if (!texture_ || texture_->is_dummy() || !renderer()) {
|
||||
software_image_ = QImage();
|
||||
software_image_up_to_date_ = true;
|
||||
return;
|
||||
@@ -76,18 +76,18 @@ void ScopeBase::UpdateSoftwareImage()
|
||||
// it into this scope's renderer before we can sample it.
|
||||
TexturePtr source_tex = texture_;
|
||||
if (texture_->renderer() && texture_->renderer() != renderer()) {
|
||||
FramePtr temp_frame = Frame::Create();
|
||||
FramePtr temp_frame = Frame::create();
|
||||
temp_frame->set_video_params(texture_->params());
|
||||
temp_frame->allocate();
|
||||
texture_->Download(temp_frame->data(), temp_frame->linesize_pixels());
|
||||
texture_->download(temp_frame->data(), temp_frame->linesize_pixels());
|
||||
|
||||
local_texture_ = renderer()->CreateTexture(
|
||||
local_texture_ = renderer()->create_texture(
|
||||
temp_frame->video_params(), temp_frame->data(),
|
||||
temp_frame->linesize_pixels());
|
||||
source_tex = local_texture_;
|
||||
}
|
||||
|
||||
if (!source_tex || source_tex->IsDummy()) {
|
||||
if (!source_tex || source_tex->is_dummy()) {
|
||||
software_image_ = QImage();
|
||||
software_image_up_to_date_ = true;
|
||||
return;
|
||||
@@ -97,94 +97,94 @@ void ScopeBase::UpdateSoftwareImage()
|
||||
const int texture_height = static_cast<int>(height() * devicePixelRatioF());
|
||||
|
||||
const VideoParams offscreen_params(texture_width, texture_height,
|
||||
PixelFormat::U8,
|
||||
VideoParams::kRGBAChannelCount);
|
||||
PixelFormat::u8,
|
||||
VideoParams::k_rgba_channel_count);
|
||||
|
||||
if (!software_tex_ || software_tex_->params() != offscreen_params) {
|
||||
software_tex_ = renderer()->CreateTexture(offscreen_params);
|
||||
software_tex_ = renderer()->create_texture(offscreen_params);
|
||||
software_buffer_.resize(
|
||||
texture_width * texture_height *
|
||||
VideoParams::GetBytesPerPixel(PixelFormat::U8,
|
||||
VideoParams::kRGBAChannelCount));
|
||||
VideoParams::get_bytes_per_pixel(PixelFormat::u8,
|
||||
VideoParams::k_rgba_channel_count));
|
||||
}
|
||||
|
||||
if (!software_tex_ || software_tex_->IsDummy()) {
|
||||
if (!software_tex_ || software_tex_->is_dummy()) {
|
||||
software_image_ = QImage();
|
||||
software_image_up_to_date_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ColorTransformJob job;
|
||||
job.SetColorProcessor(color_service());
|
||||
job.SetInputTexture(source_tex);
|
||||
job.SetInputAlphaAssociation(kAlphaNone);
|
||||
job.SetClearDestinationEnabled(true);
|
||||
job.SetForceOpaque(true);
|
||||
job.set_color_processor(color_service());
|
||||
job.set_input_texture(source_tex);
|
||||
job.set_input_alpha_association(k_alpha_none);
|
||||
job.set_clear_destination_enabled(true);
|
||||
job.set_force_opaque(true);
|
||||
|
||||
renderer()->BlitColorManaged(job, software_tex_.get());
|
||||
renderer()->DownloadFromTexture(software_tex_->id(),
|
||||
renderer()->blit_color_managed(job, software_tex_.get());
|
||||
renderer()->download_from_texture(software_tex_->id(),
|
||||
software_tex_->params(),
|
||||
software_buffer_.data(), 0);
|
||||
|
||||
software_image_ = QImage(
|
||||
reinterpret_cast<const uchar *>(software_buffer_.constData()),
|
||||
texture_width, texture_height,
|
||||
texture_width * VideoParams::GetBytesPerPixel(
|
||||
PixelFormat::U8, VideoParams::kRGBAChannelCount),
|
||||
texture_width * VideoParams::get_bytes_per_pixel(
|
||||
PixelFormat::u8, VideoParams::k_rgba_channel_count),
|
||||
QImage::Format_RGBA8888_Premultiplied);
|
||||
software_image_.setDevicePixelRatio(devicePixelRatioF());
|
||||
|
||||
software_image_up_to_date_ = true;
|
||||
}
|
||||
|
||||
void ScopeBase::OnInit()
|
||||
void ScopeBase::on_init()
|
||||
{
|
||||
super::OnInit();
|
||||
super::on_init();
|
||||
|
||||
if (!IsBackendNeutral()) {
|
||||
pipeline_ = renderer()->CreateNativeShader(GenerateShaderCode());
|
||||
if (!is_backend_neutral()) {
|
||||
pipeline_ = renderer()->create_native_shader(generate_shader_code());
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeBase::OnPaint()
|
||||
void ScopeBase::on_paint()
|
||||
{
|
||||
if (IsBackendNeutral()) {
|
||||
if (is_backend_neutral()) {
|
||||
if (!software_image_up_to_date_) {
|
||||
UpdateSoftwareImage();
|
||||
update_software_image();
|
||||
}
|
||||
|
||||
QPainter p(paint_device());
|
||||
p.fillRect(rect(), Qt::black);
|
||||
|
||||
if (!software_image_.isNull()) {
|
||||
DrawScopeSoftware(p, software_image_);
|
||||
draw_scope_software(p, software_image_);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear display surface
|
||||
renderer()->ClearDestination();
|
||||
renderer()->clear_destination();
|
||||
|
||||
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());
|
||||
managed_tex_ = renderer()->create_texture(texture_->params());
|
||||
|
||||
ColorTransformJob job;
|
||||
job.SetColorProcessor(color_service());
|
||||
job.SetInputTexture(texture_);
|
||||
job.SetInputAlphaAssociation(kAlphaNone);
|
||||
job.set_color_processor(color_service());
|
||||
job.set_input_texture(texture_);
|
||||
job.set_input_alpha_association(k_alpha_none);
|
||||
|
||||
renderer()->BlitColorManaged(job, managed_tex_.get());
|
||||
renderer()->blit_color_managed(job, managed_tex_.get());
|
||||
managed_tex_up_to_date_ = true;
|
||||
}
|
||||
|
||||
DrawScope(managed_tex_, pipeline_);
|
||||
draw_scope(managed_tex_, pipeline_);
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeBase::OnDestroy()
|
||||
void ScopeBase::on_destroy()
|
||||
{
|
||||
local_texture_ = nullptr;
|
||||
software_tex_ = nullptr;
|
||||
@@ -194,7 +194,7 @@ void ScopeBase::OnDestroy()
|
||||
texture_ = nullptr;
|
||||
pipeline_.clear();
|
||||
|
||||
super::OnDestroy();
|
||||
super::on_destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SCOPEBASE_H
|
||||
#define SCOPEBASE_H
|
||||
#ifndef OAK_SCOPEBASE_H
|
||||
#define OAK_SCOPEBASE_H
|
||||
|
||||
#include "codec/frame.h"
|
||||
#include "render/colorprocessor.h"
|
||||
@@ -36,26 +36,26 @@ public:
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(ScopeBase)
|
||||
|
||||
public slots:
|
||||
void SetBuffer(TexturePtr frame);
|
||||
void set_buffer(TexturePtr frame);
|
||||
|
||||
protected slots:
|
||||
virtual void OnInit() override;
|
||||
virtual void on_init() override;
|
||||
|
||||
virtual void OnPaint() override;
|
||||
virtual void on_paint() override;
|
||||
|
||||
virtual void OnDestroy() override;
|
||||
virtual void on_destroy() override;
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *e) override;
|
||||
|
||||
virtual ShaderCode GenerateShaderCode() = 0;
|
||||
virtual ShaderCode generate_shader_code() = 0;
|
||||
|
||||
/**
|
||||
* @brief GPU-accelerated draw function used on OpenGL backends.
|
||||
*
|
||||
* Override this if your sub-class scope needs extra drawing.
|
||||
*/
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline);
|
||||
virtual void draw_scope(TexturePtr managed_tex, QVariant pipeline);
|
||||
|
||||
/**
|
||||
* @brief Software draw function used on backend-neutral paths (e.g. Vulkan).
|
||||
@@ -63,10 +63,10 @@ protected:
|
||||
* Implementations receive an 8-bit sRGB/display-ready image and should draw
|
||||
* the scope visualization with QPainter.
|
||||
*/
|
||||
virtual void DrawScopeSoftware(QPainter &p, const QImage &image) = 0;
|
||||
virtual void draw_scope_software(QPainter &p, const QImage &image) = 0;
|
||||
|
||||
private:
|
||||
void UpdateSoftwareImage();
|
||||
void update_software_image();
|
||||
|
||||
QVariant pipeline_;
|
||||
|
||||
@@ -86,4 +86,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // SCOPEBASE_H
|
||||
#endif // OAK_SCOPEBASE_H
|
||||
|
||||
@@ -39,14 +39,14 @@ VectorscopeScope::VectorscopeScope(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderCode VectorscopeScope::GenerateShaderCode()
|
||||
ShaderCode VectorscopeScope::generate_shader_code()
|
||||
{
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbvectorscope.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbvectorscope.vert"));
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbvectorscope.frag"),
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbvectorscope.vert"));
|
||||
}
|
||||
|
||||
void VectorscopeScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
void VectorscopeScope::draw_scope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
float vectorscope_scale = 0.80f;
|
||||
float vectorscope_gain = 1.45f;
|
||||
@@ -56,32 +56,32 @@ void VectorscopeScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
|
||||
ShaderJob job;
|
||||
|
||||
job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
|
||||
job.insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::k_vec2, QVector2D(width(), height())));
|
||||
|
||||
double luma_coeffs[3] = { 0.0f, 0.0f, 0.0f };
|
||||
color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(
|
||||
color_manager()->get_default_luma_coefs(luma_coeffs);
|
||||
job.insert(
|
||||
QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3,
|
||||
NodeValue(NodeValue::k_vec3,
|
||||
QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
|
||||
job.Insert(QStringLiteral("vectorscope_scale"),
|
||||
NodeValue(NodeValue::kFloat, vectorscope_scale));
|
||||
job.Insert(QStringLiteral("vectorscope_gain"),
|
||||
NodeValue(NodeValue::kFloat, vectorscope_gain));
|
||||
job.Insert(QStringLiteral("vectorscope_point_radius"),
|
||||
NodeValue(NodeValue::kFloat, vectorscope_point_radius));
|
||||
job.Insert(QStringLiteral("vectorscope_intensity"),
|
||||
NodeValue(NodeValue::kFloat, vectorscope_intensity));
|
||||
job.Insert(QStringLiteral("vectorscope_sample_grid"),
|
||||
NodeValue(NodeValue::kFloat, vectorscope_sample_grid));
|
||||
job.insert(QStringLiteral("vectorscope_scale"),
|
||||
NodeValue(NodeValue::k_float, vectorscope_scale));
|
||||
job.insert(QStringLiteral("vectorscope_gain"),
|
||||
NodeValue(NodeValue::k_float, vectorscope_gain));
|
||||
job.insert(QStringLiteral("vectorscope_point_radius"),
|
||||
NodeValue(NodeValue::k_float, vectorscope_point_radius));
|
||||
job.insert(QStringLiteral("vectorscope_intensity"),
|
||||
NodeValue(NodeValue::k_float, vectorscope_intensity));
|
||||
job.insert(QStringLiteral("vectorscope_sample_grid"),
|
||||
NodeValue(NodeValue::k_float, vectorscope_sample_grid));
|
||||
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
job.insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::k_texture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
renderer()->blit(pipeline, job, get_viewport_params());
|
||||
|
||||
QPainter p(paint_device());
|
||||
QFont font = p.font();
|
||||
@@ -113,10 +113,10 @@ void VectorscopeScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
|
||||
const float label_radius = radius + 12.0f;
|
||||
const float marker_radius = radius * 0.72f;
|
||||
constexpr float kPi = 3.14159265358979323846f;
|
||||
constexpr float k_pi = 3.14159265358979323846f;
|
||||
|
||||
for (const Target &target : targets) {
|
||||
float radians = target.angle * kPi / 180.0f;
|
||||
float radians = target.angle * k_pi / 180.0f;
|
||||
QPointF direction(qCos(radians), -qSin(radians));
|
||||
QPointF marker = center + direction * marker_radius;
|
||||
QPointF label_pos = center + direction * label_radius;
|
||||
@@ -124,12 +124,12 @@ void VectorscopeScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
|
||||
p.drawEllipse(marker, 3.0, 3.0);
|
||||
p.drawText(label_pos.x() -
|
||||
QtUtils::QFontMetricsWidth(font_metrics, label) * 0.5,
|
||||
QtUtils::q_font_metrics_width(font_metrics, label) * 0.5,
|
||||
label_pos.y() + font_metrics.capHeight() * 0.5, label);
|
||||
}
|
||||
}
|
||||
|
||||
void VectorscopeScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
void VectorscopeScope::draw_scope_software(QPainter &p, const QImage &image)
|
||||
{
|
||||
const float vectorscope_scale = 0.80f;
|
||||
const float vectorscope_gain = 1.45f;
|
||||
@@ -139,7 +139,7 @@ void VectorscopeScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
buf.fill(Qt::transparent);
|
||||
|
||||
double luma_coeffs[3] = { 0.0, 0.0, 0.0 };
|
||||
color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
color_manager()->get_default_luma_coefs(luma_coeffs);
|
||||
|
||||
const int src_w = image.width();
|
||||
const int src_h = image.height();
|
||||
@@ -214,10 +214,10 @@ void VectorscopeScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
|
||||
const float label_radius = radius + 12.0f;
|
||||
const float marker_radius = radius * 0.72f;
|
||||
constexpr float kPi = 3.14159265358979323846f;
|
||||
constexpr float k_pi = 3.14159265358979323846f;
|
||||
|
||||
for (const Target &target : targets) {
|
||||
float radians = target.angle * kPi / 180.0f;
|
||||
float radians = target.angle * k_pi / 180.0f;
|
||||
QPointF direction(qCos(radians), -qSin(radians));
|
||||
QPointF marker = center + direction * marker_radius;
|
||||
QPointF label_pos = center + direction * label_radius;
|
||||
@@ -225,7 +225,7 @@ void VectorscopeScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
|
||||
p.drawEllipse(marker, 3.0, 3.0);
|
||||
p.drawText(label_pos.x() -
|
||||
QtUtils::QFontMetricsWidth(font_metrics, label) * 0.5,
|
||||
QtUtils::q_font_metrics_width(font_metrics, label) * 0.5,
|
||||
label_pos.y() + font_metrics.capHeight() * 0.5, label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef VECTORSCOPESCOPE_H
|
||||
#define VECTORSCOPESCOPE_H
|
||||
#ifndef OAK_VECTORSCOPESCOPE_H
|
||||
#define OAK_VECTORSCOPESCOPE_H
|
||||
|
||||
#include "widget/scope/scopebase/scopebase.h"
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(VectorscopeScope)
|
||||
|
||||
protected:
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
virtual ShaderCode generate_shader_code() override;
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
virtual void draw_scope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
|
||||
virtual void DrawScopeSoftware(QPainter &p, const QImage &image) override;
|
||||
virtual void draw_scope_software(QPainter &p, const QImage &image) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // VECTORSCOPESCOPE_H
|
||||
#endif // OAK_VECTORSCOPESCOPE_H
|
||||
|
||||
@@ -42,14 +42,14 @@ WaveformScope::WaveformScope(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderCode WaveformScope::GenerateShaderCode()
|
||||
ShaderCode WaveformScope::generate_shader_code()
|
||||
{
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.frag"),
|
||||
FileFunctions::ReadFileAsString(":/shaders/rgbwaveform.vert"));
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbwaveform.frag"),
|
||||
FileFunctions::read_file_as_string(":/shaders/rgbwaveform.vert"));
|
||||
}
|
||||
|
||||
void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
void WaveformScope::draw_scope(TexturePtr managed_tex, QVariant pipeline)
|
||||
{
|
||||
float waveform_scale = 0.80f;
|
||||
|
||||
@@ -57,27 +57,27 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
ShaderJob job;
|
||||
|
||||
// Set viewport size
|
||||
job.Insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
|
||||
job.insert(QStringLiteral("viewport"),
|
||||
NodeValue(NodeValue::k_vec2, QVector2D(width(), height())));
|
||||
|
||||
// Set luma coefficients
|
||||
double luma_coeffs[3] = { 0.0f, 0.0f, 0.0f };
|
||||
color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(
|
||||
color_manager()->get_default_luma_coefs(luma_coeffs);
|
||||
job.insert(
|
||||
QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3,
|
||||
NodeValue(NodeValue::k_vec3,
|
||||
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));
|
||||
job.insert(QStringLiteral("waveform_scale"),
|
||||
NodeValue(NodeValue::k_float, waveform_scale));
|
||||
|
||||
// Insert source texture
|
||||
job.Insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::kTexture,
|
||||
job.insert(QStringLiteral("ove_maintex"),
|
||||
NodeValue(NodeValue::k_texture,
|
||||
QVariant::fromValue(managed_tex)));
|
||||
|
||||
renderer()->Blit(pipeline, job, GetViewportParams());
|
||||
renderer()->blit(pipeline, job, get_viewport_params());
|
||||
|
||||
float waveform_dim_x = ceil((width() - 1.0) * waveform_scale);
|
||||
float waveform_dim_y = ceil((height() - 1.0) * waveform_scale);
|
||||
@@ -109,7 +109,7 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
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;
|
||||
font_x_offset = QtUtils::q_font_metrics_width(font_metrics, label) + 4;
|
||||
|
||||
p.drawText(waveform_start_dim_x - font_x_offset,
|
||||
(waveform_dim_y * (i * ire_increment)) +
|
||||
@@ -120,7 +120,7 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
|
||||
p.drawLines(ire_lines);
|
||||
}
|
||||
|
||||
void WaveformScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
void WaveformScope::draw_scope_software(QPainter &p, const QImage &image)
|
||||
{
|
||||
const float waveform_scale = 0.80f;
|
||||
const int waveform_dim_x = qCeil((width() - 1.0) * waveform_scale);
|
||||
@@ -203,7 +203,7 @@ void WaveformScope::DrawScopeSoftware(QPainter &p, const QImage &image)
|
||||
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;
|
||||
font_x_offset = QtUtils::q_font_metrics_width(font_metrics, label) + 4;
|
||||
|
||||
p.drawText(waveform_start_dim_x - font_x_offset,
|
||||
(waveform_dim_y * (i * ire_increment)) +
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef WAVEFORMSCOPE_H
|
||||
#define WAVEFORMSCOPE_H
|
||||
#ifndef OAK_WAVEFORMSCOPE_H
|
||||
#define OAK_WAVEFORMSCOPE_H
|
||||
|
||||
#include "widget/scope/scopebase/scopebase.h"
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
MANAGEDDISPLAYWIDGET_DEFAULT_DESTRUCTOR(WaveformScope)
|
||||
|
||||
protected:
|
||||
virtual ShaderCode GenerateShaderCode() override;
|
||||
virtual ShaderCode generate_shader_code() override;
|
||||
|
||||
virtual void DrawScope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
virtual void draw_scope(TexturePtr managed_tex, QVariant pipeline) override;
|
||||
|
||||
virtual void DrawScopeSoftware(QPainter &p, const QImage &image) override;
|
||||
virtual void draw_scope_software(QPainter &p, const QImage &image) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // WAVEFORMSCOPE_H
|
||||
#endif // OAK_WAVEFORMSCOPE_H
|
||||
|
||||
Reference in New Issue
Block a user