Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-03-05 18:45:11 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-05 18:56:14 +0300
commitffd5b0d91e26a1b2018d503a42f309186f39fcdf (patch)
treeef4ab4d9c7bd384e8c31adb2a8447b5a1d2e54a8
parent0729376a13a55a8e375045e8021b00cb4d9fd2e9 (diff)
Cleanup: Use blender::Vector.
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp7
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h10
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cpp51
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.h3
4 files changed, 28 insertions, 43 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 21ffb7c045e..6691e5feb5f 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -121,7 +121,7 @@ ExecutionSystem::~ExecutionSystem()
this->m_groups.clear();
}
-void ExecutionSystem::set_operations(const Operations &operations,
+void ExecutionSystem::set_operations(const blender::Vector<NodeOperation *> &operations,
const blender::Vector<ExecutionGroup *> &groups)
{
m_operations = operations;
@@ -136,10 +136,7 @@ void ExecutionSystem::execute()
DebugInfo::execute_started(this);
unsigned int order = 0;
- for (std::vector<NodeOperation *>::iterator iter = this->m_operations.begin();
- iter != this->m_operations.end();
- ++iter) {
- NodeOperation *operation = *iter;
+ for (NodeOperation *operation : m_operations) {
if (operation->isReadBufferOperation()) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
readOperation->setOffset(order);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 0314c4cfbdd..9a51baf55d7 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -21,12 +21,16 @@ class ExecutionGroup;
#pragma once
#include "BKE_text.h"
+
#include "COM_ExecutionGroup.h"
#include "COM_Node.h"
#include "COM_NodeOperation.h"
+
#include "DNA_color_types.h"
#include "DNA_node_types.h"
+#include "BLI_vector.hh"
+
/**
* \page execution Execution model
* In order to get to an efficient model for execution, several steps are being done. these steps
@@ -113,8 +117,6 @@ class ExecutionGroup;
* \brief the ExecutionSystem contains the whole compositor tree.
*/
class ExecutionSystem {
- public:
- typedef std::vector<NodeOperation *> Operations;
private:
/**
@@ -125,7 +127,7 @@ class ExecutionSystem {
/**
* \brief vector of operations
*/
- Operations m_operations;
+ blender::Vector<NodeOperation *> m_operations;
/**
* \brief vector of groups
@@ -161,7 +163,7 @@ class ExecutionSystem {
*/
~ExecutionSystem();
- void set_operations(const Operations &operations,
+ void set_operations(const blender::Vector<NodeOperation *> &operations,
const blender::Vector<ExecutionGroup *> &groups);
/**
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
index 507dfab2627..688b693080f 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
@@ -123,7 +123,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
void NodeOperationBuilder::addOperation(NodeOperation *operation)
{
- m_operations.push_back(operation);
+ m_operations.append(operation);
}
void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket,
@@ -304,8 +304,7 @@ void NodeOperationBuilder::add_operation_input_constants()
*/
using Inputs = std::vector<NodeOperationInput *>;
Inputs pending_inputs;
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
+ for (NodeOperation *op : m_operations) {
for (int k = 0; k < op->getNumberOfInputSockets(); ++k) {
NodeOperationInput *input = op->getInputSocket(k);
if (!input->isConnected()) {
@@ -406,9 +405,7 @@ void NodeOperationBuilder::resolve_proxies()
void NodeOperationBuilder::determineResolutions()
{
/* determine all resolutions of the operations (Width/Height) */
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
-
+ for (NodeOperation *op : m_operations) {
if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
@@ -417,9 +414,7 @@ void NodeOperationBuilder::determineResolutions()
}
}
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
-
+ for (NodeOperation *op : m_operations) {
if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
@@ -573,16 +568,14 @@ void NodeOperationBuilder::add_complex_operation_buffers()
/* note: complex ops and get cached here first, since adding operations
* will invalidate iterators over the main m_operations
*/
- Operations complex_ops;
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- if ((*it)->isComplex()) {
- complex_ops.push_back(*it);
+ blender::Vector<NodeOperation *> complex_ops;
+ for (NodeOperation *operation : m_operations) {
+ if (operation->isComplex()) {
+ complex_ops.append(operation);
}
}
- for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) {
- NodeOperation *op = *it;
-
+ for (NodeOperation *op : complex_ops) {
DebugInfo::operation_read_write_buffer(op);
for (int index = 0; index < op->getNumberOfInputSockets(); index++) {
@@ -622,9 +615,7 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
void NodeOperationBuilder::prune_operations()
{
Tags reachable;
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
-
+ for (NodeOperation *op : m_operations) {
/* output operations are primary executed operations */
if (op->isOutputOperation(m_context->isRendering())) {
find_reachable_operations_recursive(reachable, op);
@@ -632,12 +623,10 @@ void NodeOperationBuilder::prune_operations()
}
/* delete unreachable operations */
- Operations reachable_ops;
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
-
+ blender::Vector<NodeOperation *> reachable_ops;
+ for (NodeOperation *op : m_operations) {
if (reachable.find(op) != reachable.end()) {
- reachable_ops.push_back(op);
+ reachable_ops.append(op);
}
else {
delete op;
@@ -648,7 +637,7 @@ void NodeOperationBuilder::prune_operations()
}
/* topological (depth-first) sorting of operations */
-static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted,
+static void sort_operations_recursive(blender::Vector<NodeOperation *> &sorted,
Tags &visited,
NodeOperation *op)
{
@@ -664,17 +653,17 @@ static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted,
}
}
- sorted.push_back(op);
+ sorted.append(op);
}
void NodeOperationBuilder::sort_operations()
{
- Operations sorted;
+ blender::Vector<NodeOperation *> sorted;
sorted.reserve(m_operations.size());
Tags visited;
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- sort_operations_recursive(sorted, visited, *it);
+ for (NodeOperation *operation : m_operations) {
+ sort_operations_recursive(sorted, visited, operation);
}
m_operations = sorted;
@@ -713,9 +702,7 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
void NodeOperationBuilder::group_operations()
{
- for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
- NodeOperation *op = *it;
-
+ for (NodeOperation *op : m_operations) {
if (op->isOutputOperation(m_context->isRendering())) {
ExecutionGroup *group = make_group(op);
group->setOutputExecutionGroup(true);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
index 6d9b5b67f11..b502a12d9b1 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
@@ -62,7 +62,6 @@ class NodeOperationBuilder {
}
};
- typedef std::vector<NodeOperation *> Operations;
typedef std::vector<Link> Links;
typedef std::map<NodeOperationInput *, NodeInput *> InputSocketMap;
@@ -75,7 +74,7 @@ class NodeOperationBuilder {
const CompositorContext *m_context;
NodeGraph m_graph;
- Operations m_operations;
+ blender::Vector<NodeOperation *> m_operations;
Links m_links;
blender::Vector<ExecutionGroup *> m_groups;