diff --git a/.clang-tidy b/.clang-tidy index 584d7ee1..18200714 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -12,7 +12,6 @@ Checks: > -bugprone-easily-swappable-parameters, -bugprone-exception-escape, -bugprone-implicit-widening-of-multiplication-result, - -bugprone-incorrect-roundings, -bugprone-integer-division, -bugprone-misplaced-widening-cast, -bugprone-narrowing-conversions, diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index ab2ef6e5..3eb3130c 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -193,8 +194,8 @@ IntRect RenderTarget::getViewport(const View& view) const const auto [width, height] = Vector2f(getSize()); const FloatRect& viewport = view.getViewport(); - return IntRect({static_cast(0.5f + width * viewport.left), static_cast(0.5f + height * viewport.top)}, - {static_cast(0.5f + width * viewport.width), static_cast(0.5f + height * viewport.height)}); + return IntRect(Rect({std::lround(width * viewport.left), std::lround(height * viewport.top)}, + {std::lround(width * viewport.width), std::lround(height * viewport.height)})); }