Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2011 Blender Foundation. */
|
|
|
|
#include "COM_SetAlphaMultiplyOperation.h"
|
|
|
|
namespace blender::compositor {
|
|
|
|
SetAlphaMultiplyOperation::SetAlphaMultiplyOperation()
|
|
{
|
|
this->add_input_socket(DataType::Color);
|
|
this->add_input_socket(DataType::Value);
|
|
this->add_output_socket(DataType::Color);
|
|
|
|
input_color_ = nullptr;
|
|
input_alpha_ = nullptr;
|
|
flags_.can_be_constant = true;
|
|
}
|
|
|
|
void SetAlphaMultiplyOperation::init_execution()
|
|
{
|
|
input_color_ = get_input_socket_reader(0);
|
|
input_alpha_ = get_input_socket_reader(1);
|
|
}
|
|
|
|
void SetAlphaMultiplyOperation::execute_pixel_sampled(float output[4],
|
|
float x,
|
|
float y,
|
|
PixelSampler sampler)
|
|
{
|
|
float color_input[4];
|
|
float alpha_input[4];
|
|
|
|
input_color_->read_sampled(color_input, x, y, sampler);
|
|
input_alpha_->read_sampled(alpha_input, x, y, sampler);
|
|
|
|
mul_v4_v4fl(output, color_input, alpha_input[0]);
|
|
}
|
|
|
|
void SetAlphaMultiplyOperation::deinit_execution()
|
|
{
|
|
input_color_ = nullptr;
|
|
input_alpha_ = nullptr;
|
|
}
|
|
|
|
void SetAlphaMultiplyOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
|
const rcti &area,
|
|
Span<MemoryBuffer *> inputs)
|
|
{
|
|
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
|
|
const float *color = it.in(0);
|
|
const float alpha = *it.in(1);
|
|
mul_v4_v4fl(it.out, color, alpha);
|
|
}
|
|
}
|
|
|
|
} // namespace blender::compositor
|