diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-29 01:01:50 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-04-30 20:51:58 +0000 |
commit | 2e48010cc33000e19f79f48a77612076b12720e5 (patch) | |
tree | ced57c9684c5226ffb2d7164168e509eebef712b /src/render/jobs/updateboundingvolumejob.cpp | |
parent | 8bb9c9a7fda7c7924363ebad4731f0d60159100e (diff) |
render/jobs: eradicate Q_FOREACH loops [low-risk]
... by replacing them with C++11 range-for loops. To
avoid detaches of these mutable Qt containers, wrap
the container in qAsConst(), where needed.
This is the batch with low-risk changes. They operate
on local containers or the loop body clearly does not
cause the container to change.
Saves ~5.8KiB in text size on optimized GCC 6.0 Linux
AMD64 builds.
Change-Id: I631b99e51a48e98090c2b255bf4bbb1438ac5448
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/jobs/updateboundingvolumejob.cpp')
-rw-r--r-- | src/render/jobs/updateboundingvolumejob.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/render/jobs/updateboundingvolumejob.cpp b/src/render/jobs/updateboundingvolumejob.cpp index 9b157178b..cd6632211 100644 --- a/src/render/jobs/updateboundingvolumejob.cpp +++ b/src/render/jobs/updateboundingvolumejob.cpp @@ -57,14 +57,15 @@ namespace { void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node) { // Go to the nodes that have the most depth - Q_FOREACH (Entity *c, node->children()) + const auto children = node->children(); + for (Entity *c : children) expandWorldBoundingVolume(c); // Then traverse back from leaf to root // Initialize parent bounding volume to be equal to that of the first child - if (node->hasChildren()) { + if (!children.empty()) { Qt3DRender::Render::Sphere *parentBoundingVolume = node->worldBoundingVolumeWithChildren(); - Q_FOREACH (Entity *c, node->children()) + for (Entity *c : children) parentBoundingVolume->expandToContain(*c->worldBoundingVolumeWithChildren()); } } |