diff options
author | Thiago Marcos P. Santos <tmpsantos@users.noreply.github.com> | 2016-04-15 22:17:19 +0300 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-15 12:17:19 -0700 |
commit | d51944fbea029f734e8937f4262a1f28bc68d6f7 (patch) | |
tree | a594ca6f8f724325fcd2a8b3ccfc48e48ba6e6e3 | |
parent | 1ee0055710b31de4fa51a7cc58efe77973255114 (diff) | |
download | qtlocation-mapboxgl-d51944fbea029f734e8937f4262a1f28bc68d6f7.tar.gz |
[core] Don't copy TransformState (#3501)
-rw-r--r-- | src/mbgl/map/map.cpp | 11 | ||||
-rw-r--r-- | src/mbgl/map/transform.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.hpp | 4 |
4 files changed, 7 insertions, 12 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index d632ac805a..aab09a98e9 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -71,7 +71,6 @@ public: Map::StillImageCallback callback; size_t sourceCacheSize; - TransformState transformState; TimePoint timePoint; bool loading = false; }; @@ -147,9 +146,7 @@ void Map::update(Update flags) { impl->transform.resize(impl->view.getSize()); } - impl->transformState = impl->transform.getState(); impl->updateFlags |= flags; - impl->asyncUpdate.send(); } @@ -214,13 +211,13 @@ void Map::Impl::update() { } if (updateFlags & Update::Classes || updateFlags & Update::RecalculateStyle) { - style->recalculate(transformState.getZoom(), timePoint, mode); + style->recalculate(transform.getZoom(), timePoint, mode); } StyleUpdateParameters parameters(pixelRatio, debugOptions, timePoint, - transformState, + transform.getState(), style->workers, fileSource, *texturePool, @@ -243,10 +240,8 @@ void Map::Impl::update() { } void Map::Impl::render() { - transformState = transform.getState(); - if (!painter) { - painter = std::make_unique<Painter>(transformState, glObjectStore); + painter = std::make_unique<Painter>(transform.getState(), glObjectStore); } FrameData frameData { view.getFramebufferSize(), diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp index 980a198292..79421117b6 100644 --- a/src/mbgl/map/transform.hpp +++ b/src/mbgl/map/transform.hpp @@ -147,7 +147,7 @@ public: bool isGestureInProgress() const { return state.isGestureInProgress(); } // Transform state - TransformState getState() const { return state; } + const TransformState& getState() const { return state; } bool isRotating() const { return state.isRotating(); } bool isScaling() const { return state.isScaling(); } bool isPanning() const { return state.isPanning(); } diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index c5e9ac249a..552859343b 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -42,7 +42,7 @@ using namespace mbgl; -Painter::Painter(TransformState& state_, gl::GLObjectStore& glObjectStore_) +Painter::Painter(const TransformState& state_, gl::GLObjectStore& glObjectStore_) : state(state_), glObjectStore(glObjectStore_) { gl::debugging::enable(); diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp index d998e4e8c2..d411f8821c 100644 --- a/src/mbgl/renderer/painter.hpp +++ b/src/mbgl/renderer/painter.hpp @@ -83,7 +83,7 @@ struct FrameData { class Painter : private util::noncopyable { public: - Painter(TransformState&, gl::GLObjectStore&); + Painter(const TransformState&, gl::GLObjectStore&); ~Painter(); void render(const Style& style, @@ -155,7 +155,7 @@ private: return identity; }(); - TransformState& state; + const TransformState& state; gl::GLObjectStore& glObjectStore; FrameData frame; |