mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +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-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,
|
||||||
|
@ -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)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user