Add clang-tidy bugprone-incorrect-roundings check

This commit is contained in:
Chris Thrasher 2023-04-15 19:11:13 -06:00
parent 26b300f923
commit 31c4b9472a
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,6 @@ Checks: >
-bugprone-easily-swappable-parameters, -bugprone-easily-swappable-parameters,
-bugprone-exception-escape, -bugprone-exception-escape,
-bugprone-implicit-widening-of-multiplication-result, -bugprone-implicit-widening-of-multiplication-result,
-bugprone-incorrect-roundings,
-bugprone-integer-division, -bugprone-integer-division,
-bugprone-misplaced-widening-cast, -bugprone-misplaced-widening-cast,
-bugprone-narrowing-conversions, -bugprone-narrowing-conversions,

View File

@ -37,6 +37,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cmath>
#include <iostream> #include <iostream>
#include <mutex> #include <mutex>
#include <ostream> #include <ostream>
@ -193,8 +194,8 @@ IntRect RenderTarget::getViewport(const View& view) const
const auto [width, height] = Vector2f(getSize()); const auto [width, height] = Vector2f(getSize());
const FloatRect& viewport = view.getViewport(); const FloatRect& viewport = view.getViewport();
return IntRect({static_cast<int>(0.5f + width * viewport.left), static_cast<int>(0.5f + height * viewport.top)}, return IntRect(Rect<long>({std::lround(width * viewport.left), std::lround(height * viewport.top)},
{static_cast<int>(0.5f + width * viewport.width), static_cast<int>(0.5f + height * viewport.height)}); {std::lround(width * viewport.width), std::lround(height * viewport.height)}));
} }