From 3afdfc15a182707d24d288dcd32166c4a111d732 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 24 Mar 2016 20:31:39 +0200 Subject: [PATCH] [core] FrameHistory cleanups --- src/mbgl/renderer/frame_history.cpp | 9 +++++---- 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 f54d04c57..63aea0417 100644 --- a/src/mbgl/renderer/frame_history.cpp +++ b/src/mbgl/renderer/frame_history.cpp @@ -1,9 +1,10 @@ #include +#include 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 8f6c06a69..13a953e68 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 history; };