[Bf-blender-cvs] [0830211c952] master: Cleanup: Remove XRange and YRange in Compositor

Manuel Castilla noreply at git.blender.org
Tue Sep 28 22:02:13 CEST 2021


Commit: 0830211c952983075f420175904fa10edf7b7f08
Author: Manuel Castilla
Date:   Tue Sep 28 19:33:18 2021 +0200
Branches: master
https://developer.blender.org/rB0830211c952983075f420175904fa10edf7b7f08

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.

===================================================================

M	source/blender/compositor/COM_defines.h
M	source/blender/compositor/operations/COM_EllipseMaskOperation.cc
M	source/blender/compositor/operations/COM_MixOperation.cc

===================================================================

diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index 55b331e279f..9991414aba4 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -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
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc
index eb1fd98a590..bf6eee6d3f9 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc
@@ -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);
diff --git a/source/blender/compositor/operations/COM_MixOperation.cc b/source/blender/compositor/operations/COM_MixOperation.cc
index 4b9f4786e79..895d32e6fee 100644
--- a/source/blender/compositor/operations/COM_MixOperation.cc
+++ b/source/blender/compositor/operations/COM_MixOperation.cc
@@ -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);



More information about the Bf-blender-cvs mailing list