summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform_state.hpp
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-12-05 16:46:22 +0200
committerzmiao <miao.zhao@mapbox.com>2019-12-05 17:16:49 +0200
commit727bb6e149f82fb99fa885abcfe775d6fb063c35 (patch)
treed34f24778c3f4541295ea6ae7f7516bd2b656ff2 /src/mbgl/map/transform_state.hpp
parent3a4154642ec6f6297979b40c794f5a4751b69e7d (diff)
downloadqtlocation-mapboxgl-upstream/zmiao-refactoring-transform-state.tar.gz
[core] Add getters for matricesupstream/zmiao-refactoring-transform-state
Diffstat (limited to 'src/mbgl/map/transform_state.hpp')
-rw-r--r--src/mbgl/map/transform_state.hpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp
index 018958751d..edc7f3b9cf 100644
--- a/src/mbgl/map/transform_state.hpp
+++ b/src/mbgl/map/transform_state.hpp
@@ -52,15 +52,15 @@ struct TransformStateProperties {
axonometric = val;
return *this;
}
- TransformStateProperties& withPanning(const optional<bool>& val) {
+ TransformStateProperties& withPanningInProgress(const optional<bool>& val) {
panning = val;
return *this;
}
- TransformStateProperties& withScaling(const optional<bool>& val) {
+ TransformStateProperties& withScalingInProgress(const optional<bool>& val) {
scaling = val;
return *this;
}
- TransformStateProperties& withRotating(const optional<bool>& val) {
+ TransformStateProperties& withRotatingInProgress(const optional<bool>& val) {
rotating = val;
return *this;
}
@@ -182,11 +182,11 @@ public:
// State
bool isChanging() const;
bool isRotating() const;
- void setRotating(bool val) { rotating = val; }
+ void setRotatingInProgress(bool val) { rotating = val; }
bool isScaling() const;
- void setScaling(bool val) { scaling = val; }
+ void setScalingInProgress(bool val) { scaling = val; }
bool isPanning() const;
- void setPanning(bool val) { panning = val; }
+ void setPanningInProgress(bool val) { panning = val; }
bool isGestureInProgress() const;
void setGestureInProgress(bool val) { gestureInProgress = val; }
@@ -213,7 +213,6 @@ public:
private:
bool rotatedNorth() const;
- void updateMatrix() const;
// Viewport center offset, from [size.width / 2, size.height / 2], defined
// by |edgeInsets| in screen coordinates, with top left origin.
@@ -235,6 +234,12 @@ private:
void setScalePoint(const double scale, const ScreenCoordinate& point);
+ void updateMatricesIfNeeded() const;
+ bool needsMatricesUpdate() const { return requestMatricesUpdate; }
+ const mat4& getProjectionMatrix() const;
+ const mat4& getCoordMatrix() const;
+ const mat4& getInvertedMatrix() const;
+
private:
ConstrainMode constrainMode;
ViewportMode viewportMode;
@@ -265,7 +270,7 @@ private:
double Bc = Projection::worldSize(scale) / util::DEGREES_MAX;
double Cc = Projection::worldSize(scale) / util::M2PI;
- mutable bool matrixUpdated{false};
+ mutable bool requestMatricesUpdate{true};
mutable mat4 projectionMatrix;
mutable mat4 coordMatrix;
mutable mat4 invertedMatrix;