summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2015-02-04 13:51:52 -0800
committerAnsis Brammanis <brammanis@gmail.com>2015-02-04 13:51:52 -0800
commita49737e542dc518076add81fca7d02c0a9449ae7 (patch)
treec54c863afe1099b83d01dece606ae8a0ce0f7579 /src
parent4ec00288562f16f93ea0d46f63291b8bea4d66ac (diff)
downloadqtlocation-mapboxgl-a49737e542dc518076add81fca7d02c0a9449ae7.tar.gz
fix durations by making them milliseconds
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/style/piecewisefunction_properties.hpp4
-rw-r--r--src/mbgl/style/style_parser.cpp4
-rw-r--r--src/mbgl/style/zoom_history.hpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/style/piecewisefunction_properties.hpp b/src/mbgl/style/piecewisefunction_properties.hpp
index 69ddc7cc2a..769020002e 100644
--- a/src/mbgl/style/piecewisefunction_properties.hpp
+++ b/src/mbgl/style/piecewisefunction_properties.hpp
@@ -10,8 +10,8 @@ namespace mbgl {
template <typename T>
struct PiecewiseConstantFunction {
inline PiecewiseConstantFunction(const std::vector<std::pair<float, T>> &values_, std::chrono::duration<float> duration_) : values(values_), duration(duration_) {}
- inline PiecewiseConstantFunction(T &value) : values({{ 0, value }}), duration(300) {}
- inline PiecewiseConstantFunction() : values(), duration(300) {}
+ inline PiecewiseConstantFunction(T &value) : values({{ 0, value }}), duration(std::chrono::milliseconds(300)) {}
+ inline PiecewiseConstantFunction() : values(), duration(std::chrono::milliseconds(300)) {}
T evaluate(float z, const ZoomHistory &zoomHistory) const;
private:
diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp
index c6d3c86664..a334cecc05 100644
--- a/src/mbgl/style/style_parser.cpp
+++ b/src/mbgl/style/style_parser.cpp
@@ -341,7 +341,7 @@ std::tuple<bool, Function<T>> StyleParser::parseFunction(JSVal value) {
return std::tuple<bool, Function<T>> { true, StopsFunction<T>(std::get<1>(stops), base) };
}
-template <typename T> inline std::chrono::duration<float> defaultDurationValue() { return std::chrono::duration<float>(300.0f); }
+template <typename T> inline std::chrono::duration<float> defaultDurationValue() { return std::chrono::milliseconds(300); }
template <typename T>
std::tuple<bool, PiecewiseConstantFunction<T>> StyleParser::parsePiecewiseConstantFunction(JSVal value) {
@@ -355,7 +355,7 @@ std::tuple<bool, PiecewiseConstantFunction<T>> StyleParser::parsePiecewiseConsta
if (value.HasMember("duration")) {
JSVal value_duration = value["duration"];
if (value_duration.IsNumber()) {
- duration = static_cast<std::chrono::duration<float>>(value_duration.GetDouble());
+ duration = std::chrono::milliseconds(value_duration.GetUint());
} else {
Log::Warning(Event::ParseStyle, "duration must be numeric");
}
diff --git a/src/mbgl/style/zoom_history.hpp b/src/mbgl/style/zoom_history.hpp
index eee0d9b443..2488687108 100644
--- a/src/mbgl/style/zoom_history.hpp
+++ b/src/mbgl/style/zoom_history.hpp
@@ -17,7 +17,7 @@ struct ZoomHistory {
first = false;
lastIntegerZoom = std::floor(z);
- lastIntegerZoomTime = std::chrono::steady_clock::time_point::min();
+ lastIntegerZoomTime = std::chrono::steady_clock::time_point(std::chrono::steady_clock::duration(0));
lastZoom = z;
}