[Bf-blender-cvs] [79953d54828] master: Realtime Compositor: Fix clang tidy warnings

Omar Emara noreply at git.blender.org
Wed Aug 10 13:05:08 CEST 2022


Commit: 79953d548281870a046c4d4babccedb446cdf00a
Author: Omar Emara
Date:   Wed Aug 10 13:04:36 2022 +0200
Branches: master
https://developer.blender.org/rB79953d548281870a046c4d4babccedb446cdf00a

Realtime Compositor: Fix clang tidy warnings

Fix a number of warnings reported by Clang Tidy in the realtime
compositor's code.

Differential Revision: https://developer.blender.org/D15654

Reviewed By: Clement Foucault

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

M	source/blender/compositor/realtime_compositor/COM_operation.hh
M	source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
M	source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
M	source/blender/compositor/realtime_compositor/intern/evaluator.cc
M	source/blender/draw/engines/compositor/compositor_engine.cc
M	source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc

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

diff --git a/source/blender/compositor/realtime_compositor/COM_operation.hh b/source/blender/compositor/realtime_compositor/COM_operation.hh
index 4343401cefb..38518c00c04 100644
--- a/source/blender/compositor/realtime_compositor/COM_operation.hh
+++ b/source/blender/compositor/realtime_compositor/COM_operation.hh
@@ -146,7 +146,7 @@ class Operation {
   void declare_input_descriptor(StringRef identifier, InputDescriptor descriptor);
 
   /* Get a reference to the descriptor of the input identified by the given identified. */
-  InputDescriptor &get_input_descriptor(StringRef identified);
+  InputDescriptor &get_input_descriptor(StringRef identifier);
 
   /* Returns a reference to the compositor context. */
   Context &context();
diff --git a/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh b/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
index 357a3f88bd9..5a842e16008 100644
--- a/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
+++ b/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
@@ -35,7 +35,7 @@ class RealizeOnDomainOperation : public SimpleOperation {
   static SimpleOperation *construct_if_needed(Context &context,
                                               const Result &input_result,
                                               const InputDescriptor &input_descriptor,
-                                              const Domain &operaiton_domain);
+                                              const Domain &operation_domain);
 
  protected:
   /* The operation domain is just the target domain. */
diff --git a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
index e1b0814ccd7..d6bf74ffbee 100644
--- a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
+++ b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
@@ -51,27 +51,32 @@ SimpleOperation *ConversionOperation::construct_if_needed(Context &context,
 
   /* If the result type differs from the expected type, return an instance of an appropriate
    * conversion operation. Otherwise, return a null pointer. */
+
   if (result_type == ResultType::Float && expected_type == ResultType::Vector) {
     return new ConvertFloatToVectorOperation(context);
   }
-  else if (result_type == ResultType::Float && expected_type == ResultType::Color) {
+
+  if (result_type == ResultType::Float && expected_type == ResultType::Color) {
     return new ConvertFloatToColorOperation(context);
   }
-  else if (result_type == ResultType::Color && expected_type == ResultType::Float) {
+
+  if (result_type == ResultType::Color && expected_type == ResultType::Float) {
     return new ConvertColorToFloatOperation(context);
   }
-  else if (result_type == ResultType::Color && expected_type == ResultType::Vector) {
+
+  if (result_type == ResultType::Color && expected_type == ResultType::Vector) {
     return new ConvertColorToVectorOperation(context);
   }
-  else if (result_type == ResultType::Vector && expected_type == ResultType::Float) {
+
+  if (result_type == ResultType::Vector && expected_type == ResultType::Float) {
     return new ConvertVectorToFloatOperation(context);
   }
-  else if (result_type == ResultType::Vector && expected_type == ResultType::Color) {
+
+  if (result_type == ResultType::Vector && expected_type == ResultType::Color) {
     return new ConvertVectorToColorOperation(context);
   }
-  else {
-    return nullptr;
-  }
+
+  return nullptr;
 }
 
 /* -------------------------------------------------------------------------------------------------
diff --git a/source/blender/compositor/realtime_compositor/intern/evaluator.cc b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
index 597453baf21..d358389f2e9 100644
--- a/source/blender/compositor/realtime_compositor/intern/evaluator.cc
+++ b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
@@ -67,7 +67,7 @@ bool Evaluator::validate_node_tree()
 
 void Evaluator::compile_and_evaluate()
 {
-  derived_node_tree_.reset(new DerivedNodeTree(node_tree_, node_tree_reference_map_));
+  derived_node_tree_ = std::make_unique<DerivedNodeTree>(node_tree_, node_tree_reference_map_);
 
   if (!validate_node_tree()) {
     return;
diff --git a/source/blender/draw/engines/compositor/compositor_engine.cc b/source/blender/draw/engines/compositor/compositor_engine.cc
index b3fcf0505cb..f36a59a4ce6 100644
--- a/source/blender/draw/engines/compositor/compositor_engine.cc
+++ b/source/blender/draw/engines/compositor/compositor_engine.cc
@@ -136,7 +136,7 @@ class Engine {
 
 using namespace blender::draw::compositor;
 
-typedef struct COMPOSITOR_Data {
+struct COMPOSITOR_Data {
   DrawEngineType *engine_type;
   DRWViewportEmptyList *fbl;
   DRWViewportEmptyList *txl;
@@ -144,7 +144,7 @@ typedef struct COMPOSITOR_Data {
   DRWViewportEmptyList *stl;
   Engine *instance_data;
   char info[GPU_INFO_SIZE];
-} COMPOSITOR_Data;
+};
 
 static void compositor_engine_init(void *data)
 {
diff --git a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
index 9dcd4213949..cb3648c5680 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
@@ -7,6 +7,8 @@
 
 #include <cmath>
 
+#include "BLI_math_rotation.h"
+
 #include "UI_interface.h"
 #include "UI_resources.h"



More information about the Bf-blender-cvs mailing list