[Bf-blender-cvs] [b5f70d92c25] master: Cleanup: enum class ChunkOrdering.

Jeroen Bakker noreply at git.blender.org
Fri Mar 19 17:18:39 CET 2021


Commit: b5f70d92c25693e05c8ecbd79c76e5bb35a7ceb5
Author: Jeroen Bakker
Date:   Fri Mar 19 14:16:16 2021 +0100
Branches: master
https://developer.blender.org/rBb5f70d92c25693e05c8ecbd79c76e5bb35a7ceb5

Cleanup: enum class ChunkOrdering.

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

M	source/blender/compositor/COM_compositor.h
M	source/blender/compositor/COM_defines.h
M	source/blender/compositor/intern/COM_ExecutionGroup.cc
M	source/blender/compositor/nodes/COM_SplitViewerNode.cc
M	source/blender/compositor/nodes/COM_ViewerNode.cc
M	source/blender/compositor/operations/COM_ViewerOperation.h

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

diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index 4aae5471858..7c230c8379a 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -102,13 +102,13 @@ extern "C" {
  * ExecutionGroups that have no viewer-node,
  * will use a default one.
  * There are several possible chunk orders
- *  - [@ref OrderOfChunks.COM_TO_CENTER_OUT]:
+ *  - [@ref ChunkOrdering.CenterOut]:
  *    Start calculating from a configurable point and order by nearest chunk.
- *  - [@ref OrderOfChunks.COM_TO_RANDOM]:
+ *  - [@ref ChunkOrdering.Random]:
  *    Randomize all chunks.
- *  - [@ref OrderOfChunks.COM_TO_TOP_DOWN]:
+ *  - [@ref ChunkOrdering.TopDown]:
  *    Start calculation from the bottom to the top of the image.
- *  - [@ref OrderOfChunks.COM_TO_RULE_OF_THIRDS]:
+ *  - [@ref ChunkOrdering.RuleOfThirds]:
  *    Experimental order based on 9 hot-spots in the image.
  *
  * When the chunk-order is determined, the first few chunks will be checked if they can be scheduled.
@@ -122,7 +122,7 @@ extern "C" {
  *
  * \see ExecutionGroup.execute
  * \see ViewerOperation.getChunkOrder
- * \see OrderOfChunks
+ * \see ChunkOrdering
  *
  * \section interest Area of interest
  * An ExecutionGroup can have dependencies to other ExecutionGroup's.
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index daa64ccef24..e08c0e5fe8e 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -87,18 +87,18 @@ enum class CompositorPriority {
  * \brief The order of chunks to be scheduled
  * \ingroup Execution
  */
-typedef enum OrderOfChunks {
+enum class ChunkOrdering {
   /** \brief order from a distance to centerX/centerY */
-  COM_TO_CENTER_OUT = 0,
+  CenterOut = 0,
   /** \brief order randomly */
-  COM_TO_RANDOM = 1,
+  Random = 1,
   /** \brief no ordering */
-  COM_TO_TOP_DOWN = 2,
+  TopDown = 2,
   /** \brief experimental ordering with 9 hot-spots. */
-  COM_TO_RULE_OF_THIRDS = 3,
-} OrderOfChunks;
+  RuleOfThirds = 3,
 
-#define COM_ORDER_OF_CHUNKS_DEFAULT COM_TO_CENTER_OUT
+  Default = ChunkOrdering::CenterOut,
+};
 
 #define COM_RULE_OF_THIRDS_DIVIDER 100.0f
 
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index c14287335fd..9db018e5cf3 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -194,7 +194,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
   NodeOperation *operation = this->getOutputOperation();
   float centerX = 0.5f;
   float centerY = 0.5f;
-  OrderOfChunks order_type = COM_ORDER_OF_CHUNKS_DEFAULT;
+  ChunkOrdering order_type = ChunkOrdering::Default;
 
   if (operation->isViewerOperation()) {
     ViewerOperation *viewer = (ViewerOperation *)operation;
@@ -207,7 +207,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
   const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
 
   switch (order_type) {
-    case COM_TO_RANDOM: {
+    case ChunkOrdering::Random: {
       static blender::RandomNumberGenerator rng;
       blender::MutableSpan<unsigned int> span = chunk_order.as_mutable_span();
       /* Shuffle twice to make it more random. */
@@ -215,7 +215,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
       rng.shuffle(span);
       break;
     }
-    case COM_TO_CENTER_OUT: {
+    case ChunkOrdering::CenterOut: {
       ChunkOrderHotspot hotspot(border_width * centerX, border_height * centerY, 0.0f);
       blender::Array<ChunkOrder> chunk_orders(m_chunks_len);
       for (index = 0; index < this->m_chunks_len; index++) {
@@ -234,7 +234,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
 
       break;
     }
-    case COM_TO_RULE_OF_THIRDS: {
+    case ChunkOrdering::RuleOfThirds: {
       unsigned int tx = border_width / 6;
       unsigned int ty = border_height / 6;
       unsigned int mx = border_width / 2;
@@ -273,7 +273,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
 
       break;
     }
-    case COM_TO_TOP_DOWN:
+    case ChunkOrdering::TopDown:
     default:
       break;
   }
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cc b/source/blender/compositor/nodes/COM_SplitViewerNode.cc
index 75703876d9e..681adeaf1d3 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cc
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cc
@@ -60,7 +60,7 @@ void SplitViewerNode::convertToOperations(NodeConverter &converter,
 
   /* defaults - the viewer node has these options but not exposed for split view
    * we could use the split to define an area of interest on one axis at least */
-  viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT);
+  viewerOperation->setChunkOrder(ChunkOrdering::Default);
   viewerOperation->setCenterX(0.5f);
   viewerOperation->setCenterY(0.5f);
 
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cc b/source/blender/compositor/nodes/COM_ViewerNode.cc
index fa6c1bc3c28..359c3d3031d 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cc
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cc
@@ -47,7 +47,7 @@ void ViewerNode::convertToOperations(NodeConverter &converter,
   viewerOperation->setbNodeTree(context.getbNodeTree());
   viewerOperation->setImage(image);
   viewerOperation->setImageUser(imageUser);
-  viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
+  viewerOperation->setChunkOrder((ChunkOrdering)editorNode->custom1);
   viewerOperation->setCenterX(editorNode->custom3);
   viewerOperation->setCenterY(editorNode->custom4);
   /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index 680744c70d9..b4a7fbb4f4b 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -32,7 +32,7 @@ class ViewerOperation : public NodeOperation {
   bool m_active;
   float m_centerX;
   float m_centerY;
-  OrderOfChunks m_chunkOrder;
+  ChunkOrdering m_chunkOrder;
   bool m_doDepthBuffer;
   ImBuf *m_ibuf;
   bool m_useAlphaInput;
@@ -82,7 +82,7 @@ class ViewerOperation : public NodeOperation {
   {
     this->m_centerY = centerY;
   }
-  void setChunkOrder(OrderOfChunks tileOrder)
+  void setChunkOrder(ChunkOrdering tileOrder)
   {
     this->m_chunkOrder = tileOrder;
   }
@@ -94,7 +94,7 @@ class ViewerOperation : public NodeOperation {
   {
     return this->m_centerY;
   }
-  OrderOfChunks getChunkOrder() const
+  ChunkOrdering getChunkOrder() const
   {
     return this->m_chunkOrder;
   }



More information about the Bf-blender-cvs mailing list