Removed SignedRound and replaced std::round with std::lround where needed

Also see https://clang.llvm.org/extra/clang-tidy/checks/bugprone/incorrect-roundings.html

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-06 01:25:08 +02:00
committed by Konstantin Pastbin
parent ae349462c6
commit 76d7ef146c
22 changed files with 67 additions and 60 deletions

View File

@@ -10,6 +10,7 @@
#include "base/macros.hpp"
#include <algorithm>
#include <cmath>
#include <iterator>
#include <limits>
#include <set>
@@ -113,7 +114,7 @@ RulerHelper::RulerHelper()
void RulerHelper::Update(ScreenBase const & screen)
{
m2::PointD pivot = screen.PixelRect().Center();
int const minPxWidth = math::SignedRound(kMinPixelWidth * df::VisualParams::Instance().GetVisualScale());
int const minPxWidth = std::lround(kMinPixelWidth * df::VisualParams::Instance().GetVisualScale());
m2::PointD pt1 = screen.PtoG(pivot);
m2::PointD pt0 = screen.PtoG(pivot - m2::PointD(minPxWidth, 0));
@@ -133,7 +134,7 @@ void RulerHelper::Update(ScreenBase const & screen)
double const a = ang::AngleTo(pt1, pt0);
pt0 = mercator::GetSmPoint(pt1, cos(a) * metersDiff, sin(a) * metersDiff);
m_pixelLength = math::SignedRound(pivot.Length(screen.GtoP(pt0)));
m_pixelLength = std::round(pivot.Length(screen.GtoP(pt0)));
}
int drawScale = df::GetDrawTileScale(screen);