summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/frame_history.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/renderer/frame_history.hpp')
-rw-r--r--src/mbgl/renderer/frame_history.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mbgl/renderer/frame_history.hpp b/src/mbgl/renderer/frame_history.hpp
new file mode 100644
index 0000000000..61bb59da33
--- /dev/null
+++ b/src/mbgl/renderer/frame_history.hpp
@@ -0,0 +1,40 @@
+#ifndef MBGL_RENDERER_FRAME_HISTORY
+#define MBGL_RENDERER_FRAME_HISTORY
+
+#include <deque>
+#include <cassert>
+#include <cmath>
+
+#include <mbgl/platform/platform.hpp>
+#include <mbgl/util/time.hpp>
+
+namespace mbgl {
+
+struct FrameSnapshot {
+ explicit inline FrameSnapshot(timestamp t_, float z_) : t(t_), z(z_) {}
+ float t;
+ float z;
+};
+
+struct FadeProperties {
+ float fadedist;
+ float minfadezoom;
+ float maxfadezoom;
+ float bump;
+};
+
+class FrameHistory {
+public:
+ // Record frame history that will be used to calculate fading params
+ void record(timestamp now, float zoom);
+
+ bool needsAnimation(timestamp duration) const;
+ FadeProperties getFadeProperties(timestamp duration);
+
+public:
+ std::deque<FrameSnapshot> history;
+};
+
+}
+
+#endif