diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:01:15 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:41:14 +0300 |
commit | 1c42d4930a24d639b3aa561b9a8b4bbce05977e0 (patch) | |
tree | 68c2aae3fd5ae98b78708bea28c0b55d3f4fb5f0 /source/blender/compositor/operations/COM_KeyingClipOperation.cc | |
parent | a2ee3c3a9f01f5cb2f05f1e84a1b6c1931d9d4a4 (diff) |
Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and
use a single code style.
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingClipOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_KeyingClipOperation.cc | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cc b/source/blender/compositor/operations/COM_KeyingClipOperation.cc index e6097dd71a6..03e3f0611c0 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cc @@ -22,47 +22,47 @@ namespace blender::compositor { KeyingClipOperation::KeyingClipOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); - kernelRadius_ = 3; - kernelTolerance_ = 0.1f; + kernel_radius_ = 3; + kernel_tolerance_ = 0.1f; - clipBlack_ = 0.0f; - clipWhite_ = 1.0f; + clip_black_ = 0.0f; + clip_white_ = 1.0f; - isEdgeMatte_ = false; + is_edge_matte_ = false; this->flags.complex = true; } -void *KeyingClipOperation::initializeTileData(rcti *rect) +void *KeyingClipOperation::initialize_tile_data(rcti *rect) { - void *buffer = getInputOperation(0)->initializeTileData(rect); + void *buffer = get_input_operation(0)->initialize_tile_data(rect); return buffer; } -void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data) +void KeyingClipOperation::execute_pixel(float output[4], int x, int y, void *data) { - const int delta = kernelRadius_; - const float tolerance = kernelTolerance_; + const int delta = kernel_radius_; + const float tolerance = kernel_tolerance_; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); - int bufferWidth = inputBuffer->getWidth(); - int bufferHeight = inputBuffer->getHeight(); + int buffer_width = input_buffer->get_width(); + int buffer_height = input_buffer->get_height(); - float value = buffer[(y * bufferWidth + x)]; + float value = buffer[(y * buffer_width + x)]; bool ok = false; int start_x = max_ff(0, x - delta + 1), start_y = max_ff(0, y - delta + 1), - end_x = min_ff(x + delta - 1, bufferWidth - 1), - end_y = min_ff(y + delta - 1, bufferHeight - 1); + end_x = min_ff(x + delta - 1, buffer_width - 1), + end_y = min_ff(y + delta - 1, buffer_height - 1); - int count = 0, totalCount = (end_x - start_x + 1) * (end_y - start_y + 1) - 1; - int thresholdCount = ceil((float)totalCount * 0.9f); + int count = 0, total_count = (end_x - start_x + 1) * (end_y - start_y + 1) - 1; + int threshold_count = ceil((float)total_count * 0.9f); if (delta == 0) { ok = true; @@ -74,19 +74,19 @@ void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data continue; } - int bufferIndex = (cy * bufferWidth + cx); - float currentValue = buffer[bufferIndex]; + int buffer_index = (cy * buffer_width + cx); + float current_value = buffer[buffer_index]; - if (fabsf(currentValue - value) < tolerance) { + if (fabsf(current_value - value) < tolerance) { count++; - if (count >= thresholdCount) { + if (count >= threshold_count) { ok = true; } } } } - if (isEdgeMatte_) { + if (is_edge_matte_) { if (ok) { output[0] = 0.0f; } @@ -98,31 +98,31 @@ void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data output[0] = value; if (ok) { - if (output[0] < clipBlack_) { + if (output[0] < clip_black_) { output[0] = 0.0f; } - else if (output[0] >= clipWhite_) { + else if (output[0] >= clip_white_) { output[0] = 1.0f; } else { - output[0] = (output[0] - clipBlack_) / (clipWhite_ - clipBlack_); + output[0] = (output[0] - clip_black_) / (clip_white_ - clip_black_); } } } } -bool KeyingClipOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool KeyingClipOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmin = input->xmin - kernelRadius_; - newInput.ymin = input->ymin - kernelRadius_; - newInput.xmax = input->xmax + kernelRadius_; - newInput.ymax = input->ymax + kernelRadius_; + new_input.xmin = input->xmin - kernel_radius_; + new_input.ymin = input->ymin - kernel_radius_; + new_input.xmax = input->xmax + kernel_radius_; + new_input.ymax = input->ymax + kernel_radius_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void KeyingClipOperation::get_area_of_interest(const int input_idx, @@ -131,10 +131,10 @@ void KeyingClipOperation::get_area_of_interest(const int input_idx, { BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); - r_input_area.xmin = output_area.xmin - kernelRadius_; - r_input_area.xmax = output_area.xmax + kernelRadius_; - r_input_area.ymin = output_area.ymin - kernelRadius_; - r_input_area.ymax = output_area.ymax + kernelRadius_; + r_input_area.xmin = output_area.xmin - kernel_radius_; + r_input_area.xmax = output_area.xmax + kernel_radius_; + r_input_area.ymin = output_area.ymin - kernel_radius_; + r_input_area.ymax = output_area.ymax + kernel_radius_; } void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -144,10 +144,10 @@ void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, const MemoryBuffer *input = inputs[0]; BuffersIterator<float> it = output->iterate_with(inputs, area); - const int delta = kernelRadius_; - const float tolerance = kernelTolerance_; - const int width = this->getWidth(); - const int height = this->getHeight(); + const int delta = kernel_radius_; + const float tolerance = kernel_tolerance_; + const int width = this->get_width(); + const int height = this->get_height(); const int row_stride = input->row_stride; const int elem_stride = input->elem_stride; for (; !it.is_end(); ++it) { @@ -190,21 +190,21 @@ void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, } } - if (isEdgeMatte_) { + if (is_edge_matte_) { *it.out = ok ? 0.0f : 1.0f; } else { if (!ok) { *it.out = value; } - else if (value < clipBlack_) { + else if (value < clip_black_) { *it.out = 0.0f; } - else if (value >= clipWhite_) { + else if (value >= clip_white_) { *it.out = 1.0f; } else { - *it.out = (value - clipBlack_) / (clipWhite_ - clipBlack_); + *it.out = (value - clip_black_) / (clip_white_ - clip_black_); } } } |