Mercurial > hg > orthanc-stone
changeset 1793:c5e6379b9cd0
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 May 2021 17:23:54 +0200 |
parents | 373d7f7e796e |
children | fe5c7311a7fd |
files | OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp OrthancStone/Sources/Scene2D/MacroSceneLayer.h OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp |
diffstat | 3 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp Mon May 17 16:59:03 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp Mon May 17 17:23:54 2021 +0200 @@ -41,7 +41,7 @@ } - void MacroSceneLayer::AddLayer(ISceneLayer* layer) + size_t MacroSceneLayer::AddLayer(ISceneLayer* layer) { if (layer == NULL) { @@ -49,8 +49,10 @@ } else { + size_t index = layers_.size(); layers_.push_back(layer); BumpRevision(); + return index; } } @@ -73,8 +75,6 @@ { std::unique_ptr<MacroSceneLayer> copy(new MacroSceneLayer); - copy->Reserve(layers_.size()); - for (size_t i = 0; i < layers_.size(); i++) { assert(layers_[i] != NULL);
--- a/OrthancStone/Sources/Scene2D/MacroSceneLayer.h Mon May 17 16:59:03 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/MacroSceneLayer.h Mon May 17 17:23:54 2021 +0200 @@ -26,7 +26,7 @@ #include <Compatibility.h> // For ORTHANC_OVERRIDE -#include <vector> +#include <deque> namespace OrthancStone { @@ -37,8 +37,10 @@ class MacroSceneLayer : public ISceneLayer { private: - std::vector<ISceneLayer*> layers_; - uint64_t revision_; + // A deque is used because we need to quickly add new layers, and + // to randomly access the layers + std::deque<ISceneLayer*> layers_; + uint64_t revision_; protected: void BumpRevision() @@ -60,12 +62,7 @@ void Clear(); - void Reserve(size_t size) - { - layers_.reserve(size); - } - - void AddLayer(ISceneLayer* layer); // takes ownership + size_t AddLayer(ISceneLayer* layer); // takes ownership size_t GetSize() const {
--- a/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Mon May 17 16:59:03 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Mon May 17 17:23:54 2021 +0200 @@ -31,6 +31,8 @@ #include "Internals/OpenGLTextRenderer.h" #include "Internals/MacroLayerRenderer.h" +#include <OrthancException.h> + namespace OrthancStone { class OpenGLCompositor::Font : public boost::noncopyable