summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-05-18 13:16:33 +0100
committerMike Krus <mike.krus@kdab.com>2020-05-19 10:12:18 +0100
commita5d3199b30142e6087611fd94412d9a7c5590e1a (patch)
treec19af06d5ba168a3c04db1671838db521a9de529
parent3cda45763fe32fdd574594169212399d84c46b03 (diff)
Return children handle by reference
Avoid shared container ref counting Change-Id: Ifca20cc02ded49740484fdb977de56f93f4ddd41 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/backend/entity_p.h2
-rw-r--r--src/render/backend/entityvisitor.cpp2
-rw-r--r--src/render/jobs/computefilteredboundingvolumejob.cpp2
-rw-r--r--src/render/jobs/expandboundingvolumejob.cpp2
-rw-r--r--src/render/jobs/pickboundingvolumeutils.cpp2
-rw-r--r--src/render/jobs/updatetreeenabledjob.cpp2
-rw-r--r--src/render/jobs/updateworldtransformjob.cpp2
7 files changed, 7 insertions, 7 deletions
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 5a9340c1a..a66dd2956 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -101,7 +101,7 @@ public:
void removeFromParentChildHandles();
void appendChildHandle(HEntity childHandle);
void removeChildHandle(HEntity childHandle) { m_childrenHandles.removeOne(childHandle); }
- QVector<HEntity> childrenHandles() const { return m_childrenHandles; }
+ const QVector<HEntity> &childrenHandles() const { return m_childrenHandles; }
QVector<Entity *> children() const;
bool hasChildren() const { return !m_childrenHandles.empty(); }
void traverse(const std::function<void(Entity *)> &operation);
diff --git a/src/render/backend/entityvisitor.cpp b/src/render/backend/entityvisitor.cpp
index 87dd353bb..cd146a6ce 100644
--- a/src/render/backend/entityvisitor.cpp
+++ b/src/render/backend/entityvisitor.cpp
@@ -102,7 +102,7 @@ bool EntityVisitor::apply(Entity *root) {
if (op == Prune)
return true;
- const auto childrenHandles = root->childrenHandles();
+ const auto &childrenHandles = root->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *child = m_manager->renderNodesManager()->data(handle);
if (child != nullptr && !apply(child))
diff --git a/src/render/jobs/computefilteredboundingvolumejob.cpp b/src/render/jobs/computefilteredboundingvolumejob.cpp
index 0be3cb489..6cc9a5d3c 100644
--- a/src/render/jobs/computefilteredboundingvolumejob.cpp
+++ b/src/render/jobs/computefilteredboundingvolumejob.cpp
@@ -62,7 +62,7 @@ void expandWorldBoundingVolume(NodeManagers *manager,
{
Qt3DRender::Render::Sphere childSphere(*node->worldBoundingVolume());
// Go to the nodes that have the most depth
- const auto childrenHandles = node->childrenHandles();
+ const auto &childrenHandles = node->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *c = manager->renderNodesManager()->data(handle);
if (c && c != excludeSubTree)
diff --git a/src/render/jobs/expandboundingvolumejob.cpp b/src/render/jobs/expandboundingvolumejob.cpp
index ec783e5e0..5ea2f1b31 100644
--- a/src/render/jobs/expandboundingvolumejob.cpp
+++ b/src/render/jobs/expandboundingvolumejob.cpp
@@ -58,7 +58,7 @@ namespace {
void expandWorldBoundingVolume(NodeManagers *manager, Entity *node)
{
// Go to the nodes that have the most depth
- const auto childrenHandles = node->childrenHandles();
+ const auto &childrenHandles = node->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *c = manager->renderNodesManager()->data(handle);
if (c && c->isEnabled())
diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp
index 187b73954..f6829e6d5 100644
--- a/src/render/jobs/pickboundingvolumeutils.cpp
+++ b/src/render/jobs/pickboundingvolumeutils.cpp
@@ -833,7 +833,7 @@ bool HierarchicalEntityPicker::collectHits(NodeManagers *manager, Entity *root)
}
// and pick children
- const auto childrenHandles = current.entity->childrenHandles();
+ const auto &childrenHandles = current.entity->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *child = manager->renderNodesManager()->data(handle);
if (child) {
diff --git a/src/render/jobs/updatetreeenabledjob.cpp b/src/render/jobs/updatetreeenabledjob.cpp
index 22d6f6083..312ef3d26 100644
--- a/src/render/jobs/updatetreeenabledjob.cpp
+++ b/src/render/jobs/updatetreeenabledjob.cpp
@@ -58,7 +58,7 @@ void updateTreeEnabled(NodeManagers *manager, Entity *node, bool parentEnabled)
const bool treeEnabled = node->isEnabled() && parentEnabled;
node->setTreeEnabled(treeEnabled);
- const auto childrenHandles = node->childrenHandles();
+ const auto &childrenHandles = node->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *child = manager->renderNodesManager()->data(handle);
if (child)
diff --git a/src/render/jobs/updateworldtransformjob.cpp b/src/render/jobs/updateworldtransformjob.cpp
index 12582c297..50d04ce14 100644
--- a/src/render/jobs/updateworldtransformjob.cpp
+++ b/src/render/jobs/updateworldtransformjob.cpp
@@ -82,7 +82,7 @@ void updateWorldTransformAndBounds(NodeManagers *manager, Entity *node, const Ma
updatedTransforms.push_back({nodeTransform->peerId(), convertToQMatrix4x4(worldTransform)});
}
- const auto childrenHandles = node->childrenHandles();
+ const auto &childrenHandles = node->childrenHandles();
for (const HEntity &handle : childrenHandles) {
Entity *child = manager->renderNodesManager()->data(handle);
if (child)