diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_EllipseMaskOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_EllipseMaskOperation.cc | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc index a32f15a1b8f..e3649fc9013 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc @@ -25,19 +25,19 @@ EllipseMaskOperation::EllipseMaskOperation() this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->m_inputMask = nullptr; - this->m_inputValue = nullptr; - this->m_cosine = 0.0f; - this->m_sine = 0.0f; + m_inputMask = nullptr; + m_inputValue = nullptr; + m_cosine = 0.0f; + m_sine = 0.0f; } void EllipseMaskOperation::initExecution() { - this->m_inputMask = this->getInputSocketReader(0); - this->m_inputValue = this->getInputSocketReader(1); - const double rad = (double)this->m_data->rotation; - this->m_cosine = cos(rad); - this->m_sine = sin(rad); - this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight(); + m_inputMask = this->getInputSocketReader(0); + m_inputValue = this->getInputSocketReader(1); + const double rad = (double)m_data->rotation; + m_cosine = cos(rad); + m_sine = sin(rad); + m_aspectRatio = ((float)this->getWidth()) / this->getHeight(); } void EllipseMaskOperation::executePixelSampled(float output[4], @@ -51,26 +51,26 @@ void EllipseMaskOperation::executePixelSampled(float output[4], float rx = x / this->getWidth(); float ry = y / this->getHeight(); - const float dy = (ry - this->m_data->y) / this->m_aspectRatio; - const float dx = rx - this->m_data->x; - rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy); - ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy); + const float dy = (ry - m_data->y) / m_aspectRatio; + const float dx = rx - m_data->x; + rx = m_data->x + (m_cosine * dx + m_sine * dy); + ry = m_data->y + (-m_sine * dx + m_cosine * dy); - this->m_inputMask->readSampled(inputMask, x, y, sampler); - this->m_inputValue->readSampled(inputValue, x, y, sampler); + m_inputMask->readSampled(inputMask, x, y, sampler); + m_inputValue->readSampled(inputValue, x, y, sampler); - const float halfHeight = (this->m_data->height) / 2.0f; - const float halfWidth = this->m_data->width / 2.0f; - float sx = rx - this->m_data->x; + const float halfHeight = (m_data->height) / 2.0f; + const float halfWidth = m_data->width / 2.0f; + float sx = rx - m_data->x; sx *= sx; const float tx = halfWidth * halfWidth; - float sy = ry - this->m_data->y; + float sy = ry - m_data->y; sy *= sy; const float ty = halfHeight * halfHeight; bool inside = ((sx / tx) + (sy / ty)) < 1.0f; - switch (this->m_maskType) { + switch (m_maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { output[0] = MAX2(inputMask[0], inputValue[0]); @@ -154,24 +154,24 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output, const MemoryBuffer *input_value = inputs[1]; const float op_w = this->getWidth(); const float op_h = this->getHeight(); - const float half_w = this->m_data->width / 2.0f; - const float half_h = this->m_data->height / 2.0f; + const float half_w = m_data->width / 2.0f; + const float half_h = m_data->height / 2.0f; const float tx = half_w * half_w; const float ty = half_h * half_h; for (int y = area.ymin; y < area.ymax; y++) { const float op_ry = y / op_h; - const float dy = (op_ry - this->m_data->y) / m_aspectRatio; + const float dy = (op_ry - m_data->y) / m_aspectRatio; float *out = output->get_elem(area.xmin, y); const float *mask = input_mask->get_elem(area.xmin, y); const float *value = input_value->get_elem(area.xmin, y); for (int x = area.xmin; x < area.xmax; x++) { const float op_rx = x / op_w; - const float dx = op_rx - this->m_data->x; - const float rx = this->m_data->x + (m_cosine * dx + m_sine * dy); - const float ry = this->m_data->y + (-m_sine * dx + m_cosine * dy); - float sx = rx - this->m_data->x; + const float dx = op_rx - m_data->x; + const float rx = m_data->x + (m_cosine * dx + m_sine * dy); + const float ry = m_data->y + (-m_sine * dx + m_cosine * dy); + float sx = rx - m_data->x; sx *= sx; - float sy = ry - this->m_data->y; + float sy = ry - m_data->y; sy *= sy; const bool inside = ((sx / tx) + (sy / ty)) < 1.0f; out[0] = mask_func(inside, mask, value); @@ -185,8 +185,8 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output, void EllipseMaskOperation::deinitExecution() { - this->m_inputMask = nullptr; - this->m_inputValue = nullptr; + m_inputMask = nullptr; + m_inputValue = nullptr; } } // namespace blender::compositor |