[core] Don't copy TransformState (#3501)

This commit is contained in:
Thiago Marcos P. Santos
2016-04-15 22:17:19 +03:00
committed by John Firebaugh
parent 1ee0055710
commit d51944fbea
4 changed files with 7 additions and 12 deletions

View File

@@ -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(),

View File

@@ -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(); }

View File

@@ -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();

View File

@@ -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;