Cleanup: Remove XRange and YRange in Compositor

Mostly unused and originally meant for areas with positive values.
With canvas compositing areas position may be negative.
This commit is contained in:
Manuel Castilla 2021-09-28 19:33:18 +02:00
parent f84fb12f5d
commit 0830211c95
3 changed files with 3 additions and 23 deletions

View File

@ -127,24 +127,4 @@ constexpr float COM_BLUR_BOKEH_PIXELS = 512;
constexpr rcti COM_AREA_NONE = {0, 0, 0, 0};
constexpr rcti COM_CONSTANT_INPUT_AREA_OF_INTEREST = COM_AREA_NONE;
constexpr IndexRange XRange(const rcti &area)
{
return IndexRange(area.xmin, area.xmax - area.xmin);
}
constexpr IndexRange YRange(const rcti &area)
{
return IndexRange(area.ymin, area.ymax - area.ymin);
}
constexpr IndexRange XRange(const rcti *area)
{
return XRange(*area);
}
constexpr IndexRange YRange(const rcti *area)
{
return YRange(*area);
}
} // namespace blender::compositor

View File

@ -162,13 +162,13 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output,
const float half_h = this->m_data->height / 2.0f;
const float tx = half_w * half_w;
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 dy = (op_ry - this->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 (const int x : XRange(area)) {
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);

View File

@ -109,7 +109,7 @@ void MixBaseOperation::update_memory_buffer_partial(MemoryBuffer *output,
p.value_stride = input_value->elem_stride;
p.color1_stride = input_color1->elem_stride;
p.color2_stride = input_color2->elem_stride;
for (const int y : YRange(area)) {
for (int y = area.ymin; y < area.ymax; y++) {
p.out = output->get_elem(area.xmin, y);
p.row_end = p.out + width * output->elem_stride;
p.value = input_value->get_elem(area.xmin, y);