diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 7c717a113..194a98153 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -27,10 +27,10 @@ namespace mbgl { using namespace style; -enum class RenderState { - never, - partial, - fully +enum class RenderState : uint8_t { + Never, + Partial, + Fully, }; class Map::Impl : public style::Observer { @@ -48,7 +48,7 @@ public: View& view; FileSource& fileSource; - RenderState renderState = RenderState::never; + RenderState renderState = RenderState::Never; Transform transform; const MapMode mode; @@ -164,7 +164,7 @@ void Map::render() { return; } - if (impl->renderState == RenderState::never) { + if (impl->renderState == RenderState::Never) { impl->view.notifyMapChange(MapChangeWillStartRenderingMap); } @@ -179,9 +179,9 @@ void Map::render() { MapChangeDidFinishRenderingFrame); if (!isFullyLoaded()) { - impl->renderState = RenderState::partial; - } else if (impl->renderState != RenderState::fully) { - impl->renderState = RenderState::fully; + impl->renderState = RenderState::Partial; + } else if (impl->renderState != RenderState::Fully) { + impl->renderState = RenderState::Fully; impl->view.notifyMapChange(MapChangeDidFinishRenderingMapFullyRendered); if (impl->loading) { impl->loading = false; diff --git a/src/mbgl/util/transition.cpp b/src/mbgl/util/transition.cpp deleted file mode 100644 index 16e13108d..000000000 --- a/src/mbgl/util/transition.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include -#include - -namespace mbgl { namespace util { - -UnitBezier ease(0, 0, 0.25, 1); - -transition::~transition() = default; - -template -transition::state ease_transition::update(const TimePoint& now) const { - float t = progress(now); - if (t >= 1) { - value = to; - return complete; - } else { - value = interpolate(from, to, ease.solve(t, 0.001)); - return running; - } -} - -template class ease_transition; - -} // namespace util -} // namespace mbgl diff --git a/src/mbgl/util/transition.hpp b/src/mbgl/util/transition.hpp deleted file mode 100644 index 8176c6895..000000000 --- a/src/mbgl/util/transition.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace util { - -class transition : private noncopyable { -public: - enum state { - running, - complete - }; - - inline transition(const TimePoint& start_, const Duration& duration_) - : start(start_), - duration(duration_) {} - - inline float progress(const TimePoint& now) const { - if (duration == Duration::zero()) return 1; - if (start > now) return 0; - - return std::chrono::duration(now - start) / duration; - } - - virtual state update(const TimePoint& now) const = 0; - virtual ~transition(); - -protected: - const TimePoint start; - const Duration duration; -}; - -template -class ease_transition : public transition { -public: - ease_transition(T from_, T to_, T& value_, const TimePoint& start_, const Duration& duration_) - : transition(start_, duration_), - from(from_), - to(to_), - value(value_) {} - - state update(const TimePoint& now) const; - -private: - const T from, to; - T& value; - -}; - -template -class timeout : public transition { -public: - timeout(T final_value_, T& value_, const TimePoint& start_, const Duration& duration_) - : transition(start_, duration_), - final_value(final_value_), - value(value_) {} - - state update(const TimePoint& now) const { - if (progress(now) >= 1) { - value = final_value; - return complete; - } else { - return running; - } - } - -private: - const T final_value; - T& value; -}; - -} // namespace util -} // namespace mbgl