Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_EllipseMaskOperation.cc
| Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | void EllipseMaskOperation::apply_mask(MemoryBuffer *output, | ||||
| const MemoryBuffer *input_mask = inputs[0]; | const MemoryBuffer *input_mask = inputs[0]; | ||||
| const MemoryBuffer *input_value = inputs[1]; | const MemoryBuffer *input_value = inputs[1]; | ||||
| const float op_w = this->getWidth(); | const float op_w = this->getWidth(); | ||||
| const float op_h = this->getHeight(); | const float op_h = this->getHeight(); | ||||
| const float half_w = this->m_data->width / 2.0f; | const float half_w = this->m_data->width / 2.0f; | ||||
| const float half_h = this->m_data->height / 2.0f; | const float half_h = this->m_data->height / 2.0f; | ||||
| const float tx = half_w * half_w; | const float tx = half_w * half_w; | ||||
| const float ty = half_h * half_h; | const float ty = half_h * half_h; | ||||
| for (const int y : YRange(area)) { | for (int y = area.ymin; y < area.ymax; y++) { | ||||
| const float op_ry = y / op_h; | const float op_ry = y / op_h; | ||||
| const float dy = (op_ry - this->m_data->y) / m_aspectRatio; | const float dy = (op_ry - this->m_data->y) / m_aspectRatio; | ||||
| float *out = output->get_elem(area.xmin, y); | float *out = output->get_elem(area.xmin, y); | ||||
| const float *mask = input_mask->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); | const float *value = input_value->get_elem(area.xmin, y); | ||||
| for (const int x : XRange(area)) { | for (int x = area.xmin; x < area.xmax; x++) { | ||||
| const float op_rx = x / op_w; | const float op_rx = x / op_w; | ||||
| const float dx = op_rx - this->m_data->x; | const float dx = op_rx - this->m_data->x; | ||||
| const float rx = this->m_data->x + (m_cosine * dx + m_sine * dy); | 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); | const float ry = this->m_data->y + (-m_sine * dx + m_cosine * dy); | ||||
| float sx = rx - this->m_data->x; | float sx = rx - this->m_data->x; | ||||
| sx *= sx; | sx *= sx; | ||||
| float sy = ry - this->m_data->y; | float sy = ry - this->m_data->y; | ||||
| sy *= sy; | sy *= sy; | ||||
| Show All 17 Lines | |||||