diff options
author | Maxim Pimenov <m@maps.me> | 2018-07-23 19:29:00 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2018-07-25 18:49:59 +0300 |
commit | 845af4ae26f41e86d2db9399420c19ec04b43d05 (patch) | |
tree | 6b7c4d696579d9f5b9d304dd7ed7246767244925 /drape_frontend | |
parent | 4e146ec1ed8f8aed0d07ab6f0fe49d067b4c9901 (diff) |
[geometry] Coding style fixes.
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/animation/animation.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/animation/arrow_animation.cpp | 6 | ||||
-rw-r--r-- | drape_frontend/animation/follow_animation.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/animation/interpolators.cpp | 16 | ||||
-rw-r--r-- | drape_frontend/animation/linear_animation.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/animation/parallel_animation.cpp | 14 | ||||
-rw-r--r-- | drape_frontend/animation/parallel_animation.hpp | 1 | ||||
-rwxr-xr-x | drape_frontend/frontend_renderer.cpp | 3 | ||||
-rw-r--r-- | drape_frontend/gui/gui_text.cpp | 7 | ||||
-rw-r--r-- | drape_frontend/screen_animations.cpp | 22 | ||||
-rw-r--r-- | drape_frontend/screen_animations.hpp | 13 | ||||
-rw-r--r-- | drape_frontend/screen_operations.cpp | 4 | ||||
-rw-r--r-- | drape_frontend/user_event_stream.cpp | 2 | ||||
-rw-r--r-- | drape_frontend/user_event_stream.hpp | 3 | ||||
-rw-r--r-- | drape_frontend/visual_params.hpp | 1 |
15 files changed, 68 insertions, 48 deletions
diff --git a/drape_frontend/animation/animation.cpp b/drape_frontend/animation/animation.cpp index ddff6aa314..9c514c57b1 100644 --- a/drape_frontend/animation/animation.cpp +++ b/drape_frontend/animation/animation.cpp @@ -1,4 +1,6 @@ -#include "animation.hpp" +#include "drape_frontend/animation/animation.hpp" + +#include <algorithm> namespace df { @@ -69,7 +71,7 @@ bool Animation::GetMinDuration(Interpolator const & interpolator, double & minDu { double const duration = interpolator.GetMinDuration(); if (duration >= 0.0) - minDuration = minDuration >= 0.0 ? min(duration, minDuration) : duration; + minDuration = minDuration >= 0.0 ? std::min(duration, minDuration) : duration; else return false; } @@ -83,7 +85,7 @@ bool Animation::GetMaxDuration(Interpolator const & interpolator, double & maxDu { double const duration = interpolator.GetMaxDuration(); if (duration >= 0.0) - maxDuration = maxDuration >= 0.0 ? max(duration, maxDuration) : duration; + maxDuration = maxDuration >= 0.0 ? std::max(duration, maxDuration) : duration; else return false; } diff --git a/drape_frontend/animation/arrow_animation.cpp b/drape_frontend/animation/arrow_animation.cpp index 7cdb580b96..b54d1cdb45 100644 --- a/drape_frontend/animation/arrow_animation.cpp +++ b/drape_frontend/animation/arrow_animation.cpp @@ -1,4 +1,6 @@ -#include "arrow_animation.hpp" +#include "drape_frontend/animation/arrow_animation.hpp" + +#include <algorithm> namespace df { @@ -114,7 +116,7 @@ double ArrowAnimation::GetDuration() const if (m_angleInterpolator.IsActive()) duration = m_angleInterpolator.GetDuration(); if (m_positionInterpolator.IsActive()) - duration = max(duration, m_positionInterpolator.GetDuration()); + duration = std::max(duration, m_positionInterpolator.GetDuration()); return duration; } diff --git a/drape_frontend/animation/follow_animation.cpp b/drape_frontend/animation/follow_animation.cpp index 745bbe5413..13ee9b9812 100644 --- a/drape_frontend/animation/follow_animation.cpp +++ b/drape_frontend/animation/follow_animation.cpp @@ -1,4 +1,4 @@ -#include "follow_animation.hpp" +#include "drape_frontend/animation/follow_animation.hpp" #include "drape_frontend/animation_constants.hpp" #include "drape_frontend/animation_system.hpp" @@ -6,6 +6,8 @@ #include "base/assert.hpp" #include "base/logging.hpp" +#include <algorithm> + namespace df { @@ -157,9 +159,9 @@ double MapFollowAnimation::GetMinDuration() const double MapFollowAnimation::CalculateDuration() const { - double duration = max(m_angleInterpolator.GetDuration(), m_offsetInterpolator.GetDuration()); + double duration = std::max(m_angleInterpolator.GetDuration(), m_offsetInterpolator.GetDuration()); if (!m_isAutoZoom) - duration = max(duration, m_scaleInterpolator.GetDuration()); + duration = std::max(duration, m_scaleInterpolator.GetDuration()); return duration; } diff --git a/drape_frontend/animation/interpolators.cpp b/drape_frontend/animation/interpolators.cpp index 93c78169d7..4a4fc7f3a0 100644 --- a/drape_frontend/animation/interpolators.cpp +++ b/drape_frontend/animation/interpolators.cpp @@ -1,8 +1,10 @@ -#include "interpolators.hpp" +#include "drape_frontend/animation/interpolators.hpp" + +#include "drape_frontend/animation/interpolations.hpp" #include "base/assert.hpp" -#include "interpolations.hpp" +#include <algorithm> namespace df { @@ -60,14 +62,14 @@ void Interpolator::SetMaxDuration(double maxDuration) { m_maxDuration = maxDuration; if (m_maxDuration >= 0.0) - m_duration = min(m_duration, m_maxDuration); + m_duration = std::min(m_duration, m_maxDuration); } void Interpolator::SetMinDuration(double minDuration) { m_minDuration = minDuration; if (m_minDuration >= 0.0) - m_duration = max(m_duration, m_minDuration); + m_duration = std::max(m_duration, m_minDuration); } double Interpolator::GetMaxDuration() const @@ -85,7 +87,7 @@ double Interpolator::GetT() const if (IsFinished()) return 1.0; - return max(m_elapsedTime - m_delay, 0.0) / m_duration; + return std::max(m_elapsedTime - m_delay, 0.0) / m_duration; } double Interpolator::GetElapsedTime() const @@ -156,7 +158,7 @@ double PositionInterpolator::GetMoveDuration(double globalDistance, m2::RectD co if (pixelLength < kEps) return 0.0; - double const minSize = min(viewportRect.SizeX(), viewportRect.SizeY()); + double const minSize = std::min(viewportRect.SizeX(), viewportRect.SizeY()); if (pixelLength < kMinSpeedScalar * minSize) return kMinMoveDuration; @@ -216,7 +218,7 @@ double ScaleInterpolator::GetScaleDuration(double startScale, double endScale, b double const kPixelSpeed = isAutoZoom ? (2.0 / 1.2) : (2.0 / 0.2); if (startScale > endScale) - swap(startScale, endScale); + std::swap(startScale, endScale); return CalcAnimSpeedDuration(endScale / startScale, kPixelSpeed); } diff --git a/drape_frontend/animation/linear_animation.cpp b/drape_frontend/animation/linear_animation.cpp index 1102d64e7b..f3120d446d 100644 --- a/drape_frontend/animation/linear_animation.cpp +++ b/drape_frontend/animation/linear_animation.cpp @@ -1,7 +1,9 @@ -#include "linear_animation.hpp" +#include "drape_frontend/animation/linear_animation.hpp" #include "base/assert.hpp" +#include <algorithm> + namespace df { @@ -160,9 +162,9 @@ double MapLinearAnimation::GetDuration() const if (m_angleInterpolator.IsActive()) duration = m_angleInterpolator.GetDuration(); if (m_scaleInterpolator.IsActive()) - duration = max(duration, m_scaleInterpolator.GetDuration()); + duration = std::max(duration, m_scaleInterpolator.GetDuration()); if (m_positionInterpolator.IsActive()) - duration = max(duration, m_positionInterpolator.GetDuration()); + duration = std::max(duration, m_positionInterpolator.GetDuration()); return duration; } diff --git a/drape_frontend/animation/parallel_animation.cpp b/drape_frontend/animation/parallel_animation.cpp index 01ca6ccde3..8595bc29f7 100644 --- a/drape_frontend/animation/parallel_animation.cpp +++ b/drape_frontend/animation/parallel_animation.cpp @@ -1,7 +1,9 @@ -#include "parallel_animation.hpp" +#include "drape_frontend/animation/parallel_animation.hpp" #include "drape_frontend/animation_system.hpp" +#include <algorithm> + namespace df { @@ -15,12 +17,12 @@ void ParallelAnimation::Init(ScreenBase const & screen, TPropertyCache const & p anim->Init(screen, properties); } -string ParallelAnimation::GetCustomType() const +std::string ParallelAnimation::GetCustomType() const { return m_customType; } -void ParallelAnimation::SetCustomType(string const & type) +void ParallelAnimation::SetCustomType(std::string const & type) { m_customType = type; } @@ -76,7 +78,7 @@ double ParallelAnimation::GetDuration() const { double duration = 0.0; for (auto const & anim : m_animations) - duration = max(duration, anim->GetDuration()); + duration = std::max(duration, anim->GetDuration()); return duration; } @@ -89,7 +91,7 @@ double ParallelAnimation::GetMaxDuration() const duration = anim->GetMaxDuration(); if (duration < 0.0) return Animation::kInvalidAnimationDuration; - maxDuration = maxDuration >= 0 ? max(duration, maxDuration) : duration; + maxDuration = maxDuration >= 0 ? std::max(duration, maxDuration) : duration; } return maxDuration; } @@ -103,7 +105,7 @@ double ParallelAnimation::GetMinDuration() const duration = anim->GetMinDuration(); if (duration < 0.0) return Animation::kInvalidAnimationDuration; - minDuration = minDuration >= 0 ? min(duration, minDuration) : duration; + minDuration = minDuration >= 0 ? std::min(duration, minDuration) : duration; } return minDuration; } diff --git a/drape_frontend/animation/parallel_animation.hpp b/drape_frontend/animation/parallel_animation.hpp index 82b71d5ce1..804b73ee69 100644 --- a/drape_frontend/animation/parallel_animation.hpp +++ b/drape_frontend/animation/parallel_animation.hpp @@ -5,6 +5,7 @@ #include "drape/pointers.hpp" #include <list> +#include <string> namespace df { diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index b59fd2f198..0335dbb737 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -38,6 +38,7 @@ #include <algorithm> #include <chrono> #include <cmath> +#include <functional> #include <thread> #include <utility> @@ -2348,7 +2349,7 @@ void FrontendRenderer::RenderLayer::Sort(ref_ptr<dp::OverlayTree> overlayTree) return; RenderGroupComparator comparator; - sort(m_renderGroups.begin(), m_renderGroups.end(), ref(comparator)); + std::sort(m_renderGroups.begin(), m_renderGroups.end(), std::ref(comparator)); m_isDirty = comparator.m_pendingOnDeleteFound; while (!m_renderGroups.empty() && m_renderGroups.back()->CanBeDeleted()) diff --git a/drape_frontend/gui/gui_text.cpp b/drape_frontend/gui/gui_text.cpp index aff3874d91..234fce2a5f 100644 --- a/drape_frontend/gui/gui_text.cpp +++ b/drape_frontend/gui/gui_text.cpp @@ -11,6 +11,7 @@ #include "drape/glsl_func.hpp" #include <algorithm> +#include <array> #include <memory> #include <type_traits> @@ -19,7 +20,7 @@ namespace gui namespace { glsl::vec2 GetNormalsAndMask(dp::TextureManager::GlyphRegion const & glyph, float textRatio, - array<glsl::vec2, 4> & normals, array<glsl::vec2, 4> & maskTexCoord) + std::array<glsl::vec2, 4> & normals, std::array<glsl::vec2, 4> & maskTexCoord) { m2::PointF const pixelSize = glyph.GetPixelSize() * textRatio; m2::RectF const & r = glyph.GetTexRect(); @@ -180,7 +181,7 @@ void StaticLabel::CacheStaticText(std::string const & text, char const * delim, prevLineHeight = 0.0; for (size_t j = 0; j < regions.size(); ++j) { - array<glsl::vec2, 4> normals, maskTex; + std::array<glsl::vec2, 4> normals, maskTex; dp::TextureManager::GlyphRegion const & glyph = regions[j]; glsl::vec2 offsets = GetNormalsAndMask(glyph, textRatio, normals, maskTex); @@ -395,7 +396,7 @@ void MutableLabel::SetText(LabelResult & result, std::string text) const ASSERT(it != m_alphabet.end(), ()); if (it != m_alphabet.end()) { - array<glsl::vec2, 4> normals, maskTex; + std::array<glsl::vec2, 4> normals, maskTex; dp::TextureManager::GlyphRegion const & glyph = it->second; glsl::vec2 offsets = GetNormalsAndMask(glyph, m_textRatio, normals, maskTex); diff --git a/drape_frontend/screen_animations.cpp b/drape_frontend/screen_animations.cpp index 17c788b23f..50e3b36e57 100644 --- a/drape_frontend/screen_animations.cpp +++ b/drape_frontend/screen_animations.cpp @@ -1,19 +1,19 @@ -#include "animation_constants.hpp" -#include "screen_animations.hpp" -#include "screen_operations.hpp" +#include "drape_frontend/screen_animations.hpp" -#include "animation/follow_animation.hpp" -#include "animation/linear_animation.hpp" -#include "animation/scale_animation.hpp" -#include "animation/sequence_animation.hpp" +#include "drape_frontend/animation/follow_animation.hpp" +#include "drape_frontend/animation/linear_animation.hpp" +#include "drape_frontend/animation/scale_animation.hpp" +#include "drape_frontend/animation/sequence_animation.hpp" +#include "drape_frontend/animation_constants.hpp" +#include "drape_frontend/screen_operations.hpp" namespace df { -string const kPrettyMoveAnim = "PrettyMove"; -string const kPrettyFollowAnim = "PrettyFollow"; -string const kParallelFollowAnim = "ParallelFollow"; -string const kParallelLinearAnim = "ParallelLinear"; +std::string const kPrettyMoveAnim = "PrettyMove"; +std::string const kPrettyFollowAnim = "PrettyFollow"; +std::string const kParallelFollowAnim = "ParallelFollow"; +std::string const kParallelLinearAnim = "ParallelLinear"; drape_ptr<SequenceAnimation> GetPrettyMoveAnimation(ScreenBase const & startScreen, ScreenBase const & endScreen) { diff --git a/drape_frontend/screen_animations.hpp b/drape_frontend/screen_animations.hpp index e862eeaf12..102a9ce48b 100644 --- a/drape_frontend/screen_animations.hpp +++ b/drape_frontend/screen_animations.hpp @@ -1,16 +1,17 @@ #pragma once -#include "screen_operations.hpp" +#include "drape_frontend/animation/animation.hpp" +#include "drape_frontend/screen_operations.hpp" -#include "animation/animation.hpp" +#include <string> namespace df { -extern string const kPrettyMoveAnim; -extern string const kPrettyFollowAnim; -extern string const kParallelFollowAnim; -extern string const kParallelLinearAnim; +extern std::string const kPrettyMoveAnim; +extern std::string const kPrettyFollowAnim; +extern std::string const kParallelFollowAnim; +extern std::string const kParallelLinearAnim; class SequenceAnimation; class MapLinearAnimation; diff --git a/drape_frontend/screen_operations.cpp b/drape_frontend/screen_operations.cpp index d7c0659553..4ee855e00c 100644 --- a/drape_frontend/screen_operations.cpp +++ b/drape_frontend/screen_operations.cpp @@ -10,6 +10,8 @@ #include "platform/platform.hpp" +#include <algorithm> + namespace { @@ -37,7 +39,7 @@ bool IsScaleAllowableIn3d(int scale) double CalculateScale(m2::RectD const & pixelRect, m2::RectD const & localRect) { - return max(localRect.SizeX() / pixelRect.SizeX(), localRect.SizeY() / pixelRect.SizeY()); + return std::max(localRect.SizeX() / pixelRect.SizeX(), localRect.SizeY() / pixelRect.SizeY()); } m2::PointD CalculateCenter(double scale, m2::RectD const & pixelRect, diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index 66b3306ac7..b67fc6407f 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -623,7 +623,7 @@ void UserEventStream::ResetAnimations(Animation::Type animType, bool rewind, boo ApplyAnimations(); } -void UserEventStream::ResetAnimations(Animation::Type animType, string const & customType, bool rewind, bool finishAll) +void UserEventStream::ResetAnimations(Animation::Type animType, std::string const & customType, bool rewind, bool finishAll) { bool const hasAnimations = m_animationSystem.HasAnimations(); m_animationSystem.FinishAnimations(animType, customType, rewind, finishAll); diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp index 9282245282..9eb39c3ca6 100644 --- a/drape_frontend/user_event_stream.hpp +++ b/drape_frontend/user_event_stream.hpp @@ -17,6 +17,7 @@ #include <list> #include <memory> #include <mutex> +#include <string> namespace df { @@ -460,7 +461,7 @@ private: void ApplyAnimations(); void ResetAnimations(Animation::Type animType, bool rewind = true, bool finishAll = false); - void ResetAnimations(Animation::Type animType, string const & customType, + void ResetAnimations(Animation::Type animType, std::string const & customType, bool rewind = true, bool finishAll = false); void ResetMapPlaneAnimations(); bool InterruptFollowAnimations(bool force); diff --git a/drape_frontend/visual_params.hpp b/drape_frontend/visual_params.hpp index 614de5a313..f4739f1a5a 100644 --- a/drape_frontend/visual_params.hpp +++ b/drape_frontend/visual_params.hpp @@ -5,6 +5,7 @@ #include "std/atomic.hpp" #include "std/cstdint.hpp" +#include "std/string.hpp" #include "std/noncopyable.hpp" namespace df |