diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_PreviewOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_PreviewOperation.cc | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index 960cfda9ec0..f46f0f5b13f 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -23,70 +23,70 @@ namespace blender::compositor { -PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const unsigned int defaultWidth, - const unsigned int defaultHeight) +PreviewOperation::PreviewOperation(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const unsigned int default_width, + const unsigned int default_height) { - this->addInputSocket(DataType::Color, ResizeMode::Align); + this->add_input_socket(DataType::Color, ResizeMode::Align); preview_ = nullptr; - outputBuffer_ = nullptr; + output_buffer_ = nullptr; input_ = nullptr; divider_ = 1.0f; - viewSettings_ = viewSettings; - displaySettings_ = displaySettings; - defaultWidth_ = defaultWidth; - defaultHeight_ = defaultHeight; + view_settings_ = view_settings; + display_settings_ = display_settings; + default_width_ = default_width; + default_height_ = default_height; flags.use_viewer_border = true; flags.is_preview_operation = true; } -void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key) +void PreviewOperation::verify_preview(bNodeInstanceHash *previews, bNodeInstanceKey key) { /* Size (0, 0) ensures the preview rect is not allocated in advance, - * this is set later in initExecution once the resolution is determined. + * this is set later in init_execution once the resolution is determined. */ preview_ = BKE_node_preview_verify(previews, key, 0, 0, true); } -void PreviewOperation::initExecution() +void PreviewOperation::init_execution() { - input_ = getInputSocketReader(0); + input_ = get_input_socket_reader(0); - if (this->getWidth() == (unsigned int)preview_->xsize && - this->getHeight() == (unsigned int)preview_->ysize) { - outputBuffer_ = preview_->rect; + if (this->get_width() == (unsigned int)preview_->xsize && + this->get_height() == (unsigned int)preview_->ysize) { + output_buffer_ = preview_->rect; } - if (outputBuffer_ == nullptr) { - outputBuffer_ = (unsigned char *)MEM_callocN( - sizeof(unsigned char) * 4 * getWidth() * getHeight(), "PreviewOperation"); + if (output_buffer_ == nullptr) { + output_buffer_ = (unsigned char *)MEM_callocN( + sizeof(unsigned char) * 4 * get_width() * get_height(), "PreviewOperation"); if (preview_->rect) { MEM_freeN(preview_->rect); } - preview_->xsize = getWidth(); - preview_->ysize = getHeight(); - preview_->rect = outputBuffer_; + preview_->xsize = get_width(); + preview_->ysize = get_height(); + preview_->rect = output_buffer_; } } -void PreviewOperation::deinitExecution() +void PreviewOperation::deinit_execution() { - outputBuffer_ = nullptr; + output_buffer_ = nullptr; input_ = nullptr; } -void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void PreviewOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { int offset; float color[4]; struct ColormanageProcessor *cm_processor; - cm_processor = IMB_colormanagement_display_processor_new(viewSettings_, displaySettings_); + cm_processor = IMB_colormanagement_display_processor_new(view_settings_, display_settings_); for (int y = rect->ymin; y < rect->ymax; y++) { - offset = (y * getWidth() + rect->xmin) * 4; + offset = (y * get_width() + rect->xmin) * 4; for (int x = rect->xmin; x < rect->xmax; x++) { float rx = floor(x / divider_); float ry = floor(y / divider_); @@ -95,35 +95,35 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) color[1] = 0.0f; color[2] = 0.0f; color[3] = 1.0f; - input_->readSampled(color, rx, ry, PixelSampler::Nearest); + input_->read_sampled(color, rx, ry, PixelSampler::Nearest); IMB_colormanagement_processor_apply_v4(cm_processor, color); - rgba_float_to_uchar(outputBuffer_ + offset, color); + rgba_float_to_uchar(output_buffer_ + offset, color); offset += 4; } } IMB_colormanagement_processor_free(cm_processor); } -bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool PreviewOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmin = input->xmin / divider_; - newInput.xmax = input->xmax / divider_; - newInput.ymin = input->ymin / divider_; - newInput.ymax = input->ymax / divider_; + new_input.xmin = input->xmin / divider_; + new_input.xmax = input->xmax / divider_; + new_input.ymin = input->ymin / divider_; + new_input.ymax = input->ymax / divider_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { /* Use default preview resolution as preferred ensuring it has size so that * generated inputs (which don't have resolution on their own) are displayed */ - BLI_assert(defaultWidth_ > 0 && defaultHeight_ > 0); + BLI_assert(default_width_ > 0 && default_height_ > 0); rcti local_preferred; - BLI_rcti_init(&local_preferred, 0, defaultWidth_, 0, defaultHeight_); + BLI_rcti_init(&local_preferred, 0, default_width_, 0, default_height_); NodeOperation::determine_canvas(local_preferred, r_area); /* If resolution is 0 there are two possible scenarios: @@ -152,7 +152,7 @@ void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti BLI_rcti_init(&r_area, r_area.xmin, r_area.xmin + width, r_area.ymin, r_area.ymin + height); } -eCompositorPriority PreviewOperation::getRenderPriority() const +eCompositorPriority PreviewOperation::get_render_priority() const { return eCompositorPriority::Low; } @@ -176,12 +176,12 @@ void PreviewOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output) { MemoryBuffer *input = inputs[0]; struct ColormanageProcessor *cm_processor = IMB_colormanagement_display_processor_new( - viewSettings_, displaySettings_); + view_settings_, display_settings_); rcti buffer_area; - BLI_rcti_init(&buffer_area, 0, this->getWidth(), 0, this->getHeight()); + BLI_rcti_init(&buffer_area, 0, this->get_width(), 0, this->get_height()); BuffersIteratorBuilder<uchar> it_builder( - outputBuffer_, buffer_area, area, COM_data_type_num_channels(DataType::Color)); + output_buffer_, buffer_area, area, COM_data_type_num_channels(DataType::Color)); for (BuffersIterator<uchar> it = it_builder.build(); !it.is_end(); ++it) { const float rx = it.x / divider_; |