diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-03-24 20:31:39 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-03-24 22:02:30 +0200 |
commit | 3afdfc15a182707d24d288dcd32166c4a111d732 (patch) | |
tree | fd2dba8afef7ede3036e18ba6fce99a900c1a05c /src | |
parent | fe1b417d046e5c86278f425682057effee5bdf28 (diff) | |
download | qtlocation-mapboxgl-3afdfc15a182707d24d288dcd32166c4a111d732.tar.gz |
[core] FrameHistory cleanups
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/renderer/frame_history.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/renderer/frame_history.hpp | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp index f54d04c573..63aea0417c 100644 --- a/src/mbgl/renderer/frame_history.cpp +++ b/src/mbgl/renderer/frame_history.cpp @@ -1,9 +1,10 @@ #include <mbgl/renderer/frame_history.hpp> +#include <mbgl/util/math.hpp> using namespace mbgl; // Record frame history that will be used to calculate fading params -void FrameHistory::record(const TimePoint now, float zoom) { +void FrameHistory::record(const TimePoint& now, float zoom) { // first frame ever if (history.empty()) { history.emplace_back(FrameSnapshot{TimePoint::min(), zoom}); @@ -47,7 +48,7 @@ bool FrameHistory::needsAnimation(const Duration& duration) const { return false; } -FadeProperties FrameHistory::getFadeProperties(const TimePoint now, const Duration& duration) { +FadeProperties FrameHistory::getFadeProperties(const TimePoint& now, const Duration& duration) { // Remove frames until only one is outside the duration, or until there are only three while (history.size() > 3 && history[1].now + duration < now) { history.pop_front(); @@ -61,8 +62,8 @@ FadeProperties FrameHistory::getFadeProperties(const TimePoint now, const Durati float startingZ = history.front().z; const FrameSnapshot lastFrame = history.back(); float endingZ = lastFrame.z; - float lowZ = ::fmin(startingZ, endingZ); - float highZ = ::fmax(startingZ, endingZ); + float lowZ = util::min(startingZ, endingZ); + float highZ = util::max(startingZ, endingZ); // Calculate the speed of zooming, and how far it would zoom in terms of zoom levels in one // duration diff --git a/src/mbgl/renderer/frame_history.hpp b/src/mbgl/renderer/frame_history.hpp index 8f6c06a697..13a953e681 100644 --- a/src/mbgl/renderer/frame_history.hpp +++ b/src/mbgl/renderer/frame_history.hpp @@ -11,7 +11,6 @@ namespace mbgl { struct FrameSnapshot { - explicit inline FrameSnapshot(TimePoint now_, float z_) : now(now_), z(z_) {} const TimePoint now; float z; }; @@ -26,12 +25,12 @@ struct FadeProperties { class FrameHistory { public: // Record frame history that will be used to calculate fading params - void record(TimePoint now, float zoom); + void record(const TimePoint&, float zoom); - bool needsAnimation(const Duration& duration) const; - FadeProperties getFadeProperties(TimePoint now, const Duration& duration); + bool needsAnimation(const Duration&) const; + FadeProperties getFadeProperties(const TimePoint&, const Duration&); -public: +private: std::deque<FrameSnapshot> history; }; |