mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Add clang-tidy bugprone-incorrect-roundings
check
This commit is contained in:
parent
26b300f923
commit
31c4b9472a
@ -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,
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <ostream>
|
||||
@ -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<int>(0.5f + width * viewport.left), static_cast<int>(0.5f + height * viewport.top)},
|
||||
{static_cast<int>(0.5f + width * viewport.width), static_cast<int>(0.5f + height * viewport.height)});
|
||||
return IntRect(Rect<long>({std::lround(width * viewport.left), std::lround(height * viewport.top)},
|
||||
{std::lround(width * viewport.width), std::lround(height * viewport.height)}));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user