Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_ConstantOperation.cc
| Show All 16 Lines | |||||
| */ | */ | ||||
| #include "COM_ConstantOperation.h" | #include "COM_ConstantOperation.h" | ||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| ConstantOperation::ConstantOperation() | ConstantOperation::ConstantOperation() | ||||
| { | { | ||||
| needs_resolution_to_get_constant_ = false; | needs_canvas_to_get_constant_ = false; | ||||
| flags.is_constant_operation = true; | flags.is_constant_operation = true; | ||||
| flags.is_fullframe_operation = true; | flags.is_fullframe_operation = true; | ||||
| } | } | ||||
| bool ConstantOperation::can_get_constant_elem() const | bool ConstantOperation::can_get_constant_elem() const | ||||
| { | { | ||||
| return !needs_resolution_to_get_constant_ || this->flags.is_resolution_set; | return !needs_canvas_to_get_constant_ || this->flags.is_canvas_set; | ||||
| } | } | ||||
| void ConstantOperation::update_memory_buffer(MemoryBuffer *output, | void ConstantOperation::update_memory_buffer(MemoryBuffer *output, | ||||
| const rcti &area, | const rcti &area, | ||||
| Span<MemoryBuffer *> UNUSED(inputs)) | Span<MemoryBuffer *> UNUSED(inputs)) | ||||
| { | { | ||||
| BLI_assert(output->is_a_single_elem()); | BLI_assert(output->is_a_single_elem()); | ||||
| const float *constant = get_constant_elem(); | const float *constant = get_constant_elem(); | ||||
| float *out = output->get_elem(area.xmin, area.ymin); | float *out = output->get_elem(area.xmin, area.ymin); | ||||
| memcpy(out, constant, output->get_elem_bytes_len()); | memcpy(out, constant, output->get_elem_bytes_len()); | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||