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:
+24
-24
@@ -28,26 +28,26 @@ namespace olive
|
||||
namespace plugin
|
||||
{
|
||||
|
||||
static const char *PixelDepthToOfx(core::PixelFormat format)
|
||||
static const char *pixel_depth_to_ofx(core::PixelFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case core::PixelFormat::U8:
|
||||
case core::PixelFormat::u8:
|
||||
return kOfxBitDepthByte;
|
||||
case core::PixelFormat::U16:
|
||||
case core::PixelFormat::u16:
|
||||
return kOfxBitDepthShort;
|
||||
case core::PixelFormat::F16:
|
||||
case core::PixelFormat::f16:
|
||||
return kOfxBitDepthHalf;
|
||||
case core::PixelFormat::F32:
|
||||
case core::PixelFormat::f32:
|
||||
return kOfxBitDepthFloat;
|
||||
case core::PixelFormat::INVALID:
|
||||
case core::PixelFormat::COUNT:
|
||||
case core::PixelFormat::invalid:
|
||||
case core::PixelFormat::count:
|
||||
break;
|
||||
}
|
||||
|
||||
return kOfxBitDepthNone;
|
||||
}
|
||||
|
||||
static const char *ComponentsToOfx(int channel_count)
|
||||
static const char *components_to_ofx(int channel_count)
|
||||
{
|
||||
switch (channel_count) {
|
||||
case 1:
|
||||
@@ -67,7 +67,7 @@ Image::Image(OFX::Host::ImageEffect::ClipInstance &clip_instance)
|
||||
: OFX::Host::ImageEffect::Image(clip_instance)
|
||||
, width_(0)
|
||||
, height_(0)
|
||||
, format_(core::PixelFormat::INVALID)
|
||||
, format_(core::PixelFormat::invalid)
|
||||
, premultiplied_alpha_(false)
|
||||
, channel_count_(0)
|
||||
, row_bytes_(0)
|
||||
@@ -82,30 +82,30 @@ Image::Image(OFX::Host::ImageEffect::ClipInstance &clip_instance,
|
||||
: OFX::Host::ImageEffect::Image(clip_instance)
|
||||
, width_(0)
|
||||
, height_(0)
|
||||
, format_(core::PixelFormat::INVALID)
|
||||
, format_(core::PixelFormat::invalid)
|
||||
, premultiplied_alpha_(false)
|
||||
, channel_count_(0)
|
||||
, row_bytes_(0)
|
||||
, bounds_{ 0, 0, 0, 0 }
|
||||
, rod_{ 0, 0, 0, 0 }
|
||||
{
|
||||
AllocateFromParams(params, bounds, rod, clear);
|
||||
allocate_from_params(params, bounds, rod, clear);
|
||||
}
|
||||
|
||||
Image::~Image()
|
||||
{
|
||||
}
|
||||
|
||||
void Image::AllocateFromParams(const VideoParams ¶ms,
|
||||
void Image::allocate_from_params(const VideoParams ¶ms,
|
||||
const OfxRectI &bounds, const OfxRectI &rod,
|
||||
bool clear)
|
||||
{
|
||||
Allocate(bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, params.format(),
|
||||
allocate(bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, params.format(),
|
||||
params.channel_count(), params.premultiplied_alpha(), bounds, rod,
|
||||
clear);
|
||||
}
|
||||
|
||||
void Image::EnsureAllocatedFromParams(const VideoParams ¶ms,
|
||||
void Image::ensure_allocated_from_params(const VideoParams ¶ms,
|
||||
const OfxRectI &bounds,
|
||||
const OfxRectI &rod, bool clear)
|
||||
{
|
||||
@@ -120,13 +120,13 @@ void Image::EnsureAllocatedFromParams(const VideoParams ¶ms,
|
||||
(rod_.x2 == rod.x2) && (rod_.y2 == rod.y2);
|
||||
|
||||
if (!same) {
|
||||
AllocateFromParams(params, bounds, rod, clear);
|
||||
allocate_from_params(params, bounds, rod, clear);
|
||||
} else if (clear && !image_.empty()) {
|
||||
std::fill(image_.begin(), image_.end(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Image::Allocate(int width, int height, core::PixelFormat format,
|
||||
void Image::allocate(int width, int height, core::PixelFormat format,
|
||||
int channel_count, bool premultiplied_alpha,
|
||||
const OfxRectI &bounds, const OfxRectI &rod, bool clear)
|
||||
{
|
||||
@@ -161,8 +161,8 @@ void Image::Allocate(int width, int height, core::PixelFormat format,
|
||||
setIntProperty(kOfxImagePropRegionOfDefinition, rod.x2, 2);
|
||||
setIntProperty(kOfxImagePropRegionOfDefinition, rod.y2, 3);
|
||||
setStringProperty(kOfxImageEffectPropComponents,
|
||||
ComponentsToOfx(channel_count_));
|
||||
setStringProperty(kOfxImageEffectPropPixelDepth, PixelDepthToOfx(format_));
|
||||
components_to_ofx(channel_count_));
|
||||
setStringProperty(kOfxImageEffectPropPixelDepth, pixel_depth_to_ofx(format_));
|
||||
setStringProperty(kOfxImageEffectPropPreMultiplication,
|
||||
premultiplied_alpha_ ? kOfxImagePreMultiplied :
|
||||
kOfxImageUnPreMultiplied);
|
||||
@@ -170,21 +170,21 @@ void Image::Allocate(int width, int height, core::PixelFormat format,
|
||||
|
||||
core::PixelFormat Image::pixel_format()
|
||||
{
|
||||
if (format_ != core::PixelFormat::INVALID) {
|
||||
if (format_ != core::PixelFormat::invalid) {
|
||||
return format_;
|
||||
}
|
||||
|
||||
std::string type = getStringProperty(kOfxImageEffectPropPixelDepth);
|
||||
if (type == kOfxBitDepthByte) {
|
||||
format_ = core::PixelFormat::U8;
|
||||
format_ = core::PixelFormat::u8;
|
||||
} else if (type == kOfxBitDepthShort) {
|
||||
format_ = core::PixelFormat::U16;
|
||||
format_ = core::PixelFormat::u16;
|
||||
} else if (type == kOfxBitDepthHalf) {
|
||||
format_ = core::PixelFormat::F16;
|
||||
format_ = core::PixelFormat::f16;
|
||||
} else if (type == kOfxBitDepthFloat) {
|
||||
format_ = core::PixelFormat::F32;
|
||||
format_ = core::PixelFormat::f32;
|
||||
} else {
|
||||
format_ = core::PixelFormat::INVALID;
|
||||
format_ = core::PixelFormat::invalid;
|
||||
}
|
||||
return format_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user